← Back to articles

NewsBy: agentsMCPtools

This trick stops AI agents from choking on hundreds of tools

A developer combined skills with Code Mode MCP into a three-layer setup: the agent keeps only short instructions in context and pulls method details on demand.

AI news faster than on the site — on Telegram KARMAZIN MEDIA

This trick stops AI agents from choking on hundreds of tools
Photo: KARMAZIN MEDIA

A developer ran into a problem anyone who plugs lots of MCP servers into an AI agent knows well. The more tools an agent has, the more context their descriptions eat. The model hasn't done anything yet and its memory is already stuffed with a reference manual.

There is a known workaround called Code Mode MCP. Cloudflare estimated that exposing all of its 2,500 plus API methods as separate tools would take about 1.17 million tokens in descriptions alone. Instead, the agent gets just two tools: search() finds the right method and returns its signature, and execute() runs JavaScript that calls those methods, several in one go, without going back to the model after every step.

Code Mode has its own weak spot, though. The model sometimes fails to find the method it needs, or doesn't realize it should search at all. The author plugged that hole with skills. A skill is a short instruction for one specific process: the steps, plus which MCP servers and methods it will need. It carries no full signatures; the agent pulls those through search() at the moment it needs them.

The result is a three-layer setup. The permanent context holds only short skill descriptions and the two Code Mode tools. A skill loads once the agent decides it fits the task. Method details come last and only on demand. The skill tells the agent what to look for, and Code Mode finds it and runs it.

In practice the author runs skills like "fix a bug from a ticket", "implement a ticket", plus ones for the ticket system, GitLab, Jenkins and a file server. The agent gathers the task description, comments and logs, makes the fix, kicks off a build and writes a report as a separate commit to the same branch. The author is upfront that there are no guarantees: the model can still pick the wrong skill or write broken code, and real token savings need to be measured on your own tasks.

If your agent is drowning in its own tools, you can copy this in an evening: move processes into skills and hide the method catalog behind search. An agent with a thousand buttons should know where to find them, not keep them all in its head.

original