MCPcopy Index your code
hub / github.com/GuDaStudio/GrokSearch / plan_tool_mapping

Function plan_tool_mapping

src/grok_search/server.py:791–813  ·  view source on GitHub ↗
(
    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,
)

Source from the content-addressed store, hash-verified

789 description="Phase 5: Map a sub-query to a tool. Call once per mapping; data accumulates.",
790)
791async 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(

Callers

nothing calls this directly

Calls 2

get_sessionMethod · 0.80
process_phaseMethod · 0.80

Tested by

no test coverage detected