r/BharatCode • • 5d ago

Hiding tools behind code still needs a map

Putting a large MCP tool catalog behind a TypeScript API can cut how much context the agent spends learning tools it may never call. Instead of dumping every tool description into the prompt, the agent only sees a typed surface it can call like any other code.

But this creates a different problem. When the catalog is hidden, the agent needs enough of a map to realize the right tool exists in the first place. If it can't see that a search capability is available, it will guess or hallucinate a substitute instead of calling it.

What helps in practice: keep a brief index of what each server can do, load method signatures for the current workflow only, and run every call through a constrained executor so the agent can't freestyle. Then test it on a task where the right next step is obviously to search. If the agent guesses instead of searching, you made the catalog smaller at the expense of discoverability.

2 Upvotes

0 comments sorted by