Mcp tool routing

From mouadja02/skills · View interactive version

Mcp tool routing is an AI agent skill from the GitHub repository mouadja02/skills. Use when designing scalable MCP tool routing, dynamic tool retrieval, agent-tool graphs, tool inventory indexing, or routing policies for agents with many available tools.

How to use this skill

Skill file

MCP Tool Routing

Use this skill when an agent has too many tools to place in context at once, when MCP server inventories change, or when routing errors dominate agent failures.

Core Principle

Treat tool routing as a retrieval system with governance. Do not stuff every tool schema into the prompt. Maintain a synchronized tool index, retrieve candidate tools at runtime, rerank with capability and safety signals, and expose only the smallest useful tool set to the agent.

Routing Workflow

  1. Build a tool inventory
  1. Create retrieval documents
  1. Route dynamically
  1. Verify before invocation
  1. Measure routing

Graph Routing

Use graph routing when tool capabilities are nested under agents, servers, or workflows.

Represent:

Add edges such as owns_tool, requires_scope, works_with, conflicts_with, and handles_domain. Retrieve candidate tools and agents, then traverse the graph to load the final server or specialist agent.

Helper Script

Use tool_inventory_graph.py to audit a JSON MCP inventory and emit a graph-oriented routing report:

python scripts/tool_inventory_graph.py mcp-tools.json

References

Read routing-patterns.md for implementation patterns and failure modes.

External grounding:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.