agentleFS
plumbkitplumbkit/plumb/.claude/skills/add-mcp-tool/SKILL.md

add-mcp-tool

Skill4 starsChanged 4 months agoMITView on GitHub

Add a new MCP tool to plumb — file layout, Tool interface, WriteDeps, registration, lean-profile decision, tests, and every doc/table that must be updated. Use when creating, renaming, or removing a plumb MCP tool.

6 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions6 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 6

    1. dylanroscover/Embody★ 185same name
    2. tacticlaunch/mcp-linear★ 146same name
    3. radimsem/remindb★ 129same name
    4. paulieb89/property-shared★ 16same name
    5. dabowman/Figmagent★ 0same name
    6. dragoscv/axiom★ 0same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository3 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

4 rules. 0 are common, 0 are distinctive, and 4 are very specific to this project.

  • 0

    Common

    Most of the 6 edited versions we read keep these.

  • 0

    Distinctive

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Create internal/tools/<name>.go implementing the Tool interface from internal/mcp/tools.go: Name, Description, InputSchema, Execute.

    line 10
  2. Very specific:

    Every Tool.Execute() must be a thin orchestrator over named, individually-testable steps (parse/validate → domain logic → presentation).

    line 22
  3. Very specific:

    Write/edit tools take a single WriteDeps parameter — don't grow the constructor with positional params.

    line 39
  4. Very specific:

    Add internal/tools/<name>_test.go.

    line 67

“Common” is measured: kept by at least 6 in 10 of the 6 edited versions of this file we could read. “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

Adding an MCP tool to plumb

1. File layout and the Tool interface

Create internal/tools/<name>.go implementing the Tool interface from internal/mcp/tools.go: Name, Description, InputSchema, Execute.

The Description is the authoritative per-tool reference clients read via tools/list — describe what the tool does and its params/quirks. Workflow steering that spans multiple tools (routing prose like "prefer this over grep") belongs in a skill, not the description — see the boundary rule in private/docs/internal/skills-strategy.md (plumb-ops): "Tool descriptions describe the tool. Skills describe the workflow of combining tools."

2. The thin-orchestrator Execute() pattern

Every Tool.Execute() must be a thin orchestrator over named, individually-testable steps (parse/validate → domain logic → presentation). PRs that add a monolithic Execute() are non-conforming. Each inner function stays under gocyclo 15.

func (t *Foo) Execute(ctx context.Context, raw json.RawMessage) (string, error) {
    args, err := parseFooArgs(raw)        // JSON decode + shape validation only
    if err != nil { return "", err }
    if err := args.validate(); err != nil { return "", err }
    res, err := t.run(ctx, args)          // domain logic — no formatting
    if err != nil { return "", err }
    return formatFooResult(res), nil      // presentation — no logic
}

3. WriteDeps for write/edit tools

Write/edit tools take a single WriteDeps parameter — don't grow the constructor with positional params. Adding a new cross-cutting concern (locking, LSP notify, quality analysis, rate limiting, …) means adding a field to WriteDeps, not a new argument threaded through every write tool's constructor.

4. Register the tool, and decide lean vs hidden

Register in registerAllTools (internal/cli/conn_register.go), called from handleConn (internal/cli/daemon.go); write tools use the shared writeDeps.

Then decide whether the new tool belongs in the lean profile. Read the mutation-lane rule in internal/tools/profile.go: a read-only commodity tool may be hidden freely under the lean profile, but a mutation tool whose native fallback is unsafe (bypasses plumb's per-path locks, LSP notify, or the transaction WAL) must stay in LeanTools. LeanTools doubles as the Claude Code AlwaysLoad (never-deferred) set — editing it changes both which clients see the tool under the lean profile and whether Claude Code pins its schema up front instead of deferring it to ToolSearch. Don't add a tool to LeanTools casually; it is a shared, high-stakes list.

Update internal/tools/profile_test.go's fixture sets, or the test will catch it for you. leanToolSet/nonLeanToolSet instantiate every registered tool (nil/zero deps) to measure the lean-vs-full tools/list payload — add your new constructor to whichever set matches the decision above. TestFullToolSet_Count derives the expected total from registerAllTools itself (a source scan, not a hardcoded literal), so forgetting this step now fails that test loudly instead of silently skewing TestLeanProfileBudget's ratio.

5. Tests

Add internal/tools/<name>_test.go; WriteDeps{} is the nil-safe zero-value setup for write-tool tests.

Don't forget the canonical coverage list. The expected tool set lives in the selftest coverage groups in internal/mcp/selftest_prompt.go — add the new tool's name to the matching group (or remove/rename it there). Two tests enforce it: the integration-gated TestSmoke_ToolListParity (build-tagged integration; asserts the live tools/list equals the list — plain go test ./... skips it) and the plain-unit TestAgentsToolCount (internal/mcp; asserts the AGENTS.md documented count equals the list — fails fast in every go test/make verify).

6. Docs and tables to update

  • docs/tools.md — full tool reference.
  • AGENTS.md's ## Available tools (N) heading (bump the count) and its index bullet (which category/bullet the new tool belongs under). The count is test-enforced: TestAgentsToolCount fails plain go test if the heading disagrees with the canonical list in internal/mcp/selftest_prompt.go.
  • CHANGELOG.md — one entry for the change.

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.