(
session_id: Annotated[str, "Session ID from plan_intent"],
thought: Annotated[str, "Reasoning for this mapping"],
sub_query_id: Annotated[str, "Sub-query ID to map"],
tool: Annotated[str, "web_search | web_fetch | web_map"],
reason: Annotated[str, "Why this tool for this sub-query"],
confidence: Annotated[float, "Confidence 0.0-1.0"] = 1.0,
params_json: Annotated[str, "Optional JSON string for tool-specific params"] = "",
is_revision: Annotated[bool, "True to replace all mappings"] = False,
)
| 789 | description="Phase 5: Map a sub-query to a tool. Call once per mapping; data accumulates.", |
| 790 | ) |
| 791 | async def plan_tool_mapping( |
| 792 | session_id: Annotated[str, "Session ID from plan_intent"], |
| 793 | thought: Annotated[str, "Reasoning for this mapping"], |
| 794 | sub_query_id: Annotated[str, "Sub-query ID to map"], |
| 795 | tool: Annotated[str, "web_search | web_fetch | web_map"], |
| 796 | reason: Annotated[str, "Why this tool for this sub-query"], |
| 797 | confidence: Annotated[float, "Confidence 0.0-1.0"] = 1.0, |
| 798 | params_json: Annotated[str, "Optional JSON string for tool-specific params"] = "", |
| 799 | is_revision: Annotated[bool, "True to replace all mappings"] = False, |
| 800 | ) -> str: |
| 801 | import json |
| 802 | if not planning_engine.get_session(session_id): |
| 803 | return json.dumps({"error": f"Session '{session_id}' not found. Call plan_intent first."}) |
| 804 | item = {"sub_query_id": sub_query_id, "tool": tool, "reason": reason} |
| 805 | if params_json: |
| 806 | try: |
| 807 | item["params"] = json.loads(params_json) |
| 808 | except json.JSONDecodeError: |
| 809 | pass |
| 810 | return json.dumps(planning_engine.process_phase( |
| 811 | phase="tool_selection", thought=thought, session_id=session_id, |
| 812 | is_revision=is_revision, confidence=confidence, phase_data=item, |
| 813 | ), ensure_ascii=False, indent=2) |
| 814 | |
| 815 | |
| 816 | @mcp.tool( |
nothing calls this directly
no test coverage detected