lean-mcp-tools
Skill36 starsChanged 17 days agoBSD-3-ClauseView on GitHub
Use when adding or editing an MCP tool definition - its name, title, description, inputSchema or annotations - when a server's tools/list looks expensive, when deciding whether a fact belongs in a tool description or the server instructions, or when the context cost of an MCP server needs measuring or budgeting.
In this repository3 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- changelog-entrySkill
- repo-docsSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 69
Add outputSchema for economy.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Lean MCP tools
A response is paid for when a tool is called. A definition is paid for on every request, called
or not, because the client sends all of them with each one. Server instructions sit between: once
per session. Put each fact where its audience reads it.
| Fact | Goes in |
| True of every tool ("all durations are in milliseconds") | instructions |
| Why a caller picks this tool over its neighbour | that tool's description |
| A value | the response |
What a definition holds
name,title- the display field.annotations.titleis a second copy; drop it.description- the selection prompt: what it returns, when to pick it, nothing the schema below already says.inputSchema- adescribeonly for what the property name and its type cannot say.annotations- only spec hints that differ from the default and carry meaning.destructiveHintandidempotentHintare defined as meaningful only whenreadOnlyHintis false, so a read-only tool declaresreadOnlyHint: trueandopenWorldHint: falseand stops. There is nopriorityhint.
Restructure before you delete
Deleting a fact costs the answer and saves less than reshaping it.
- Ten per-category properties, each inlining the same enum, became
z.partialRecord(z.enum(CATEGORIES), z.enum(LEVELS))- each enum emitted once. ~844 tokens to ~428, wire form unchanged, unknown keys now rejected. (Plainz.recordis cheaper still, but marks every key required.) - Hold the values as an
as consttuple and build the schema from it, so no description restates them.
Measure the whole wire object
estimateTokens(JSON.stringify(tool)); // per tool, from a live tools/list over stdioA budget over {name, description, inputSchema} guards a subset of the cost: it let title,
annotations and the SDK's own fields grow ~215 tokens unwatched.
A definition is not finished until a check covers it. Three assertions, in the gate that already runs the server:
- A per-tool budget, ~5% headroom, so one careless sentence fails.
- A cap on the total, held as a constant and raised only on purpose, with the reason beside it. This also catches a new tool.
- Selection keywords, one or two per tool. Clients match the words in the description, so a trim that saves tokens can cost discovery. Make that trade fail loudly.
Generate every published figure from the run, so a stale number fails too. Pin annotations with unit tests; a budget with headroom will not notice a hint coming back.
Know the floor
$schema, from zod's toJSONSchema, and execution, added by the SDK, cost ~90 tokens across four
tools and have no public hook. Record the floor; do not reach into SDK internals for it.
Do not
- Merge tools to save tokens. It breaks callers, tests and clients that register by tool name, and a flattened schema stops saying which parameter belongs to which mode.
- Add
outputSchemafor economy. The spec asks for the payload in a text block too, so it goes twice.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

