← BACK TO BLOG

How MCP Lazy-Loading Works

How MCP Lazy-Loading Works

Published: August 12, 2026
Author: Andromity Core

The Model Context Protocol (MCP) is a game-changer for connecting LLMs to external systems. However, as developers add more tools, they run into a major bottleneck: context exhaustion.

In this article, we explain how Andromity solves this problem using Smart Lazy-Loading to support 50+ connected tools without consuming unnecessary tokens.


The Token bloat problem

Every tool schema in an MCP server contains:

  • The tool's name
  • A descriptive string explaining what the tool does
  • A JSON Schema defining all input parameters, types, and descriptions

If you connect 5 database servers, 3 API clients, and a few filesystem tools, your total schema content can easily exceed 15,000 tokens. Ingesting this into every prompt loop eats your token budget and degrades model reasoning.


Andromity’s Lazy-Loading Strategy

Andromity splits the tool discovery process into two phases:

MARKUP
[Startup: Quick Indexing]
  └─ Load tool NAMES & 1-sentence descriptions only.
  
[Prompt Loop: Semantic Matching]
  └─ Does prompt content require external help?
       ├── YES ──> Inject ONLY the specific tool's full JSON schema.
       └── NO  ──> Keep schema context empty.
Phase 1: Compact Indexing

On startup, Andromity connects to the MCP servers, downloads tool metadata, and indexes only the names and short summaries. The actual JSON parameters are discarded from active memory.

Phase 2: Intent Detection

During active chat conversations, Andromity performs semantic match-checking on the user request. If the user mentions "query active users in db", Andromity identifies that the sqlite-db/query_users tool is relevant.

Phase 3: Dynamic Schema Injection

Only then is the full parameter schema for sqlite-db/query_users loaded and injected into the active prompt payload sent to the LLM. The LLM can then successfully call the tool.


Results

Smart Lazy-Loading results in a 85% reduction in idle prompt tokens. This means you can hook up dozens of external APIs and databases to Andromity without seeing your token bills skyrocket.