Flows category icon
MCP & Tooling
Advanced

Deferred Tool Loading

Stop paying context for tools the task never needs: load a core set eagerly and expand the toolset on demand.

4 steps12 verify checks90-120 minutesWorks with: emergent · chatgpt · claude · cursor
Start Guided Walkthrough

The Route

0/4 verified

Context Pack

Paste this first. It briefs the AI on requirements, constraints, and the Definition of Done before your first build prompt.

Context Pack
PROJECT CONTEXT:
My agent's tool definitions eat a huge slice of every context window, and most tasks use five of the forty tools. Harness analyses show the fix: a small always-on core plus discovery and on-demand loading for the long tail.

GOAL:
Implement deferred tool loading: an eager core set, a tool-discovery mechanism, dynamic registration mid-session, and measured context savings.

REQUIREMENTS:
- Tool usage analysis identifying the true core set
- A compact catalog of deferred tools (name + one-line purpose) discoverable by the model
- A load_tools mechanism that registers deferred tools mid-session
- Session-scoped loading: tools loaded stay loaded for the session
- Before/after measurement of context spent on tool definitions

CONSTRAINTS:
- Deferring must not break workflows - discovery has to be reliable enough that the model finds what it needs
- The catalog must cost a small fraction of what the full definitions cost

DEFINITION OF DONE:
- Context spent on tool definitions drops substantially on typical tasks
- The model successfully discovers and loads a deferred tool when a task needs it
- Loaded tools function identically to eagerly-loaded ones
- A task-completion regression suite shows no capability loss

COMMON FAILURES TO AVOID:
- Deferring a tool the model needs but never discovers, silently degrading capability
- A catalog so verbose it costs as much as the definitions it replaced
- Cache-hostile loading that invalidates the prompt prefix every registration
- No measurement, so the 'optimization' is faith-based

Paste this into your AI builder first. It teaches the AI what you want before you give it the build prompt.

Related routes

More MCP & Tooling flows that share ground with this one.

Flows category icon
MCP & Tooling

Build Your First MCP Server

Stand up a working MCP server exposing your own tools, connect a client, and validate the full call loop.

01Choose tools worth exposing and set up the SDK
02Implement the server and tools
03Connect a host and verify discovery

+1 more steps to Done

Best forbuilders who have shipped a basic app before

4 steps90-120 minutesIntermediate
Flows category icon
MCP & Tooling

Testing MCP Tools

Bring TDD discipline to MCP servers: unit-test handlers, protocol-test the surface, and contract-test against a real host.

01Separate logic from protocol glue
02Write the handler unit suite
03Add protocol and contract layers

+1 more steps to Done

Best forbuilders who have shipped a basic app before

4 steps60-90 minutesIntermediate
Flows category icon
MCP & Tooling

Tool Descriptions That Steer the Model

Treat tool descriptions as prompt engineering: when-to-use guidance, negative cases, and worked examples that fix tool-choice errors.

01Collect misroutes and map overlaps
02Rewrite descriptions to steer
03Verify with a routing test

Best foryour first pass at this - no prior setup assumed

3 steps45-60 minutesBeginner

Made with Emergent