agentleFS
certiniacertinia/debug-log-analyzer-mcp/.claude/skills/lean-mcp-tools/SKILL.md

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.

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
  1. Very specific:

    Add outputSchema for economy.

    line 69

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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.

FactGoes in
True of every tool ("all durations are in milliseconds")instructions
Why a caller picks this tool over its neighbourthat tool's description
A valuethe response

What a definition holds

  • name, title - the display field. annotations.title is a second copy; drop it.
  • description - the selection prompt: what it returns, when to pick it, nothing the schema below already says.
  • inputSchema - a describe only for what the property name and its type cannot say.
  • annotations - only spec hints that differ from the default and carry meaning. destructiveHint and idempotentHint are defined as meaningful only when readOnlyHint is false, so a read-only tool declares readOnlyHint: true and openWorldHint: false and stops. There is no priority hint.

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. (Plain z.record is cheaper still, but marks every key required.)
  • Hold the values as an as const tuple 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 stdio

A 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:

  1. A per-tool budget, ~5% headroom, so one careless sentence fails.
  2. 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.
  3. 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 outputSchema for economy. The spec asks for the payload in a text block too, so it goes twice.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.