MCP, Tool Orchestration, and Audit (v2)
Two tool paths
ToolOrchestrationStep(direct tool mode)
- request-driven via
tool_request - executes one tool
- runs
POST_TOOL_EXECUTIONrules - writes
context.mcp.toolExecution.*
McpToolStep(planner loop mode)
- planner loop (
CALL_TOOL/ANSWER) - writes
context.mcp.observations[]andcontext.mcp.finalAnswer - runs
POST_AGENT_MCPrules - writes
context.mcp.lifecycle.*
Guardrail blocked branch
If planner proposes a blocked next tool:
mcp_status=GUARDRAIL_BLOCKED_NEXT_TOOL- fallback final text is written to
context.mcp.finalAnswer POST_AGENT_MCPrules still run- response is still finalized by
ce_responseresolution
Rule-ready MCP metadata
context.mcp.lifecycle includes:
phase,status,outcome,finishedblocked,error,errorMessagelastAction,lastToolCode,lastToolGroup,lastToolArgstoolExecuted
context.mcp.toolExecution includes:
phase,status,outcome,finishederror,scopeMismatch,toolExecutedtoolCode,toolGroup,meta,result,errorMessage
JSON_PATH examples for ce_rule.match_pattern
$[?(@.context.mcp.lifecycle.finished == true && @.context.mcp.lifecycle.outcome == 'BLOCKED')]
$[?(@.context.mcp.lifecycle.error == true)]
$[?(@.context.mcp.toolExecution.phase == 'POST_TOOL_EXECUTION' && @.context.mcp.toolExecution.status == 'SUCCESS')]
$[?(@.context.mcp.toolExecution.scopeMismatch == true)]
Audit stages to watch
Tool orchestration path:
TOOL_ORCHESTRATION_REQUESTTOOL_ORCHESTRATION_RESULTTOOL_ORCHESTRATION_ERROR
Planner MCP path:
MCP_PLAN_LLM_INPUTMCP_PLAN_LLM_OUTPUTMCP_TOOL_CALLMCP_TOOL_RESULTMCP_TOOL_ERRORMCP_FINAL_ANSWER
Rule phases around these paths:
RULE_MATCH (McpToolStep)/RULE_NO_MATCH (McpToolStep)RULE_MATCH (ToolOrchestrationStep PostTool)/RULE_NO_MATCH (ToolOrchestrationStep PostTool)RULE_MATCH (AgentIntentResolver)/RULE_NO_MATCH (AgentIntentResolver)RULE_MATCH (RulesStep)/RULE_NO_MATCH (RulesStep)
Scope enforcement
ce_mcp_tool and ce_mcp_planner are scope-validated at startup:
- null/blank scope rows are rejected
intent_codemust beANY,UNKNOWN, or defined ince_intentstate_codemust beANY,UNKNOWN, or present ince_rule.state_code