Flows category icon
MCP & Tooling
Intermediate

Design Tool Schemas for Agents

Write tool schemas that constrain model behavior: tight types, enums over strings, and parameters that make misuse hard.

4 steps12 verify checks60-90 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 misuses tools constantly: wrong argument shapes, invented parameters, dangerous free-text fields. Harness source analyses show schemas are behavior-shaping instruments - the tighter the schema, the better the model behaves.

GOAL:
Redesign my tool schemas as constraints: precise types, enums, bounded values, required-ness that matches reality, and validation errors that teach.

REQUIREMENTS:
- Every tool parameter typed as tightly as its domain allows (enums, ranges, formats)
- Free-text parameters justified or eliminated - each one is a misuse surface
- Required vs optional matching actual semantics, with safe defaults documented in the schema
- Validation that rejects unknown parameters and returns teaching errors
- A misuse test suite: known bad calls that must be rejected with useful messages

CONSTRAINTS:
- Schemas are the contract - handlers must never accept what the schema rejects
- Descriptions inside schemas count: every field description guides the model

DEFINITION OF DONE:
- A misuse suite of 10 bad calls is fully rejected with actionable errors
- No tool accepts unknown/extra parameters silently
- Enum-able string fields are enums; numeric fields have ranges
- Field descriptions state purpose, format, and an example value

COMMON FAILURES TO AVOID:
- Stringly-typed everything, inviting the model to improvise
- Optional parameters that are actually required, causing silent wrong behavior
- Extra invented parameters absorbed silently by permissive parsing
- Validation errors like 'invalid input' that teach the model nothing

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

Structured Output from Tools

Make every tool and agent output validate against a schema: typed results, repair loops, and safe fallbacks.

01Map the boundaries and define types
02Enforce schemas at generation time
03Build the repair loop and fallbacks

+1 more steps to Done

Best forbuilders who have shipped a basic app before

4 steps60-90 minutesIntermediate
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

Build a Repo Map for Code Navigation

Give your agent compressed, ranked codebase awareness - the tree-sitter repo-map pattern that beats raw file dumps.

01Extract symbols per file
02Rank by relevance
03Render within budget

+1 more steps to Done

Best forproduction-grade builds with strict verification

4 steps90-150 minutesAdvanced

Made with Emergent