Skip to main content
Glama

test_routing

Simulate agent selection for routing based on input text and strategy without actual execution, enabling efficient planning and testing for ACP-MCP Server integrations.

Instructions

Test routing without executing - shows which agent would be selected

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
input_textYes
strategyNodefault

Implementation Reference

  • The test_routing MCP tool handler function. It tests which agent a given input_text would be routed to using the specified strategy, without executing the agent. Returns JSON with input, strategy, target_agent, routing_reason, and would_execute flag.
    @mcp.tool()
    async def test_routing(
        input_text: str,
        strategy: str = "default"
    ) -> str:
        """Test routing without executing - shows which agent would be selected"""
        
        try:
            target_agent, routing_reason = await router.route_request(input_text, strategy)
            
            result = {
                "input": input_text,
                "strategy": strategy,
                "target_agent": target_agent,
                "routing_reason": routing_reason,
                "would_execute": True
            }
            
            return json.dumps(result, indent=2)
            
        except Exception as e:
            return f"Error: {e}"
  • Registration of the router tools (including test_routing) by calling register_router_tools on the MCP instance with the AgentRouter instance.
    register_router_tools(self.mcp, self.router)

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/GongRzhe/ACP-MCP-Server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server