agentleFS
refined-elementrefined-element/lightning-enable-mcp/.claude/skills/new-mcp-tool/SKILL.md

new-mcp-tool

Skill9 starsChanged 36 days agoMITView on GitHub

Scaffold a new MCP tool with models, service method, and DI registration

  • Reads credentials

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. tstephx/book-mcp-server★ 1same 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. About 0 are common, 2 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Create a new MCP tool following project conventions.

    line 6
  2. Very specific:

    Add [Description("...")] on EVERY parameter

    line 13
  3. Distinctive:

    Use flat parameters (no complex objects)

    line 14
  4. Very specific:

    Use [Description] on every parameter — MCP clients use these for documentation

    line 55

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 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

Create a new MCP tool following project conventions. Use $ARGUMENTS for the tool name and description.

Steps

  1. Create tool class in the appropriate tools directory
    • Static class with [McpServerToolType] attribute
    • Static method with [McpServerTool(Name = "snake_case_name")] attribute
    • Add [Description("...")] on EVERY parameter
    • Use flat parameters (no complex objects)
    • Nullable optional service injection for wallet services
    • Include IsConfigured check — return error result if required service not configured
  2. Add models to the appropriate models file if needed
    • Request/response records
  3. Add service interface method in the service interface if the tool needs business logic beyond direct API calls
  4. Implement service method in the implementation class
  5. Update DI registration in Program.cs if new services are needed
  6. Write tests following existing test patterns

Patterns to Follow

[McpServerToolType]
public static class MyNewTool
{
    [McpServerTool(Name = "my_new_tool")]
    [Description("What this tool does")]
    public static async Task<string> Execute(
        [Description("Parameter description")] string requiredParam,
        [Description("Optional parameter")] string? optionalParam = null,
        IMyService? myService = null)
    {
        if (myService is null || !myService.IsConfigured)
            return "Error: MyService is not configured. Set MY_ENV_VAR environment variable.";

        // Implementation
        return JsonSerializer.Serialize(result, new JsonSerializerOptions { WriteIndented = true });
    }
}

Key Conventions

  • Tool name: snake_case (e.g., get_btc_price, check_wallet_balance)
  • Class name: PascalCase + "Tool" suffix
  • Return JSON-serialized results for structured data
  • Use [Description] on every parameter — MCP clients use these for documentation
  • Wallet priority: LND > NWC > Strike > OpenNode
  • L402 requires preimage — only works with LND, Strike, CoinOS NWC, CLINK NWC, Alby Hub NWC

Free vs Paid

When you add a tool, update the inventory guard tests — they are the single source of truth for the advertised tool count, and they fail until the code and the declared lists match:

  • FREE_TOOLS in python/lightning-enable-mcp/tests/test_server.py and FreeTools in dotnet/tests/LightningEnable.Mcp.Tests/ToolInventoryTests.cs — tools that work with just a wallet (no license).
  • API_KEY_TOOLS / ApiKeyTools in the same files — tools that require an Agentic Commerce subscription + LIGHTNING_ENABLE_API_KEY (e.g. the producer tools create_l402_challenge, verify_l402_payment). Add license-check logic in the tool itself if it should be paid.

Public docs no longer hard-code the count (except the MCP Complete Guide's self-counting table), so there is nothing else to bump.

Suggested follow-up: /mcp-publish-prep when ready to publish

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.