---
title: "How do you stop MCP tool definitions from filling an agent's context window?"
description: "Don't load every tool schema up front. Let the agent search for tools and read exact schemas only when it needs them. How Kazi does it."
url: "https://kazi.apifunnel.ai/answers/stop-mcp-tool-definitions-filling-the-context-window"
updated: "2026-11-14"
---

# How do you stop MCP tool definitions from filling an agent's context window?

Don't load every tool's schema into the prompt; let the agent search for the tools it needs and read their exact schemas only at that point. Connect a few large MCP servers and the definitions alone can eat a big share of the context before the user says a word. Kazi indexes your tools and finds them on demand, and runs multi-step API work as code instead of one tool call at a time.

## Where the tokens go

Every tool an agent might call needs a name, a description and an input schema in its context. Ten tools is nothing. Five servers with 50 tools each is a few hundred definitions, sent on every turn, mostly unused.

It costs twice: you pay for those tokens on every turn, and the model has to pick the right tool from a crowd, which it does worse.

## Progressive discovery

- List the services available, with a line each.
- Search for tools relevant to the task.
- Fetch the exact schema for the one or two tools you're about to call.

The agent carries a small, stable set of discovery tools instead of the whole catalog. Your own MCP servers get indexed the same way when you connect them.

## Code execution does the rest

The other big waste is tool results. Pull 2,000 rows through a tool call and they all land in context. Run the call in code, filter there, and only the answer comes back. That's why Kazi runs multi-step API work as Python in a sandbox. Details in [why AI agents need code execution](https://kazi.apifunnel.ai/blog/code-execution-progressive-discovery).

## Related questions

- [How do I connect my own MCP server to an AI assistant?](https://kazi.apifunnel.ai/answers/connect-your-own-mcp-server-to-an-ai-assistant)
- [How can an AI agent call my own API without me writing an integration?](https://kazi.apifunnel.ai/answers/let-an-ai-agent-call-your-own-api)
- [How do you make an AI agent check its prerequisites before it acts?](https://kazi.apifunnel.ai/answers/make-an-ai-agent-check-prerequisites-before-it-acts)
