Agent skill

Add an MCP Tool to remindb

by radimsem in radimsem/remindb

Checklist for adding a new Memory-prefixed tool to remindb's Go MCP server: tool file, registration, test, skill docs, plus the locking and logging rules.

MITAuto-check passedAgent Workflows

Install Add an MCP Tool to remindb

skills CLI
$ npx skills add radimsem/remindb --skill add-mcp-tool -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install radimsem/remindb add-mcp-tool --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/radimsem/remindb.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/add-mcp-tool .claude/skills/add-mcp-tool && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
add-mcp-tool
GitHub stars
129
Token cost
~2.1k tokens
SKILL.md length
746 words
Files
1
Skills in repo
11
Repo updated
First seen
Licence
MIT

At a glance

Checklist for adding a new Memory-prefixed tool to remindb's Go MCP server: tool file, registration, test, skill docs, plus the locking and logging rules.

  • Works in 5 steps: Named return values for the deferred… → defer d.logCall(...) on the first line.… → Locking decision (see below). → …
  • Exposing a new capability to MCP clients in remindb
  • SKILL.md covers Where it lands, Tool file template, Locking and The registration entry, plus 5 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Each tool is a file in pkg/mcp/tools, written as a method on the Deps type that takes a typed input struct, calls into the Store, Engine or Tracker and returns a call result with text content. Adding one means four changes plus a docs sync: a new tool file with an input struct and handler, an AddTool entry in registerTools in pkg/mcp/server.go, a test in tools_test.go using the mcptest environment, and an update to the remind or memorize skill's tool inventory.

Rules every tool follows: named return values so the deferred logCall helper can capture the final error, logCall as the first line with the Memory prefix, error wrapping with %w, and one formatted text string as the result. Locking depends on the kind of tool. Read-only tools such as MemorySearch and MemoryFetch skip the store's OpMu mutex, while mutating tools such as MemoryWrite and MemorySummarize take it right after the deferred logger and release it with a defer.

When your agent uses it

  • Exposing a new capability to MCP clients in remindb
  • Registering a new MemoryXxx tool in registerTools
  • Deciding whether a new tool needs to take the store lock
  • Adding tests and skill inventory entries for a new tool

Example prompts

  • “Add a MemoryCount tool to remindb that returns how many entries the store holds.”
  • “Wire this new handler into registerTools and write its test with mcptest.NewEnv.”
  • “Does a tool that only reads from the store need OpMu? Check against the existing tools.”
  • “Update the remind skill's tool inventory for the new MemoryPrune tool.”

Requirements

  • A checkout of the remindb repository and a Go toolchain

Workflow steps

5 steps, taken from the first numbered list in SKILL.md.

  1. Named return values for the deferred logger. (_ gomcp.CallToolResult, any, err error) is the SDK signature; the err name is required so…
  2. defer d.logCall(...) on the first line. Prefix the tool name with Memory to match the registered name. Pass enough attrs to debug a…
  3. Locking decision (see below).
  4. Error wrapping. Action errors take failed to : per go-concise.md §5; wrap the engine/store error with %w so callers can errors.Is.
  5. Return *mcp.CallToolResult with text content. Format complex results into one string before returning — clients render text, not…

What it can do on your machine

Read from SKILL.md and the folder at commit 977b31c. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are go).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Add an MCP Tool to remindb loads about 2.1k tokens when it runs. Until then it costs about 79 tokens; SKILL.md has 746 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~79
When it runs · the whole SKILL.md, loaded when a task matches
~2.1k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from radimsem/remindb at commit 977b31c, republished under its MIT licence (© radimsem). 746 words, ~2,073 tokens.

Download SKILL.mdSave it as .claude/skills/add-mcp-tool/SKILL.md (or your agent's skills folder).
name
add-mcp-tool
description
Use when adding a new `Memory*` tool to remindb's MCP server — symptoms include "expose X over MCP", "register a new tool with the SDK", "add an endpoint to pkg/mcp/tools/", "wire a new MemoryXxx into registerTools", or any task that gives MCP clients a new capability backed by the store/engine/tracker.

Add a new MCP tool

Tools live in pkg/mcp/tools/ as one file per tool. Each tool is a method on *Deps that takes a typed input struct, calls into Store / Engine / Tracker, and returns a *mcp.CallToolResult with text content. Adding one means four changes plus a docs sync.

Where it lands

FileWhat changes
pkg/mcp/tools/<tool>.goNew file — XxxInput struct + HandleXxx method on *Deps
pkg/mcp/server.goAdd a mcp.AddTool(srv, ...) entry to registerTools
pkg/mcp/tools/tools_test.goTest using mcptest.NewEnv from internal/mcptest
skills/remind/SKILL.md (read tools) or skills/memorize/SKILL.md (write tools)Add the new tool to the inventory and any pattern section it belongs in

Tool file template

The shape is uniform across fetch.go, search.go, summarize.go, write.go. Mirror it.

go
package tools

import (
    "context"
    "fmt"
    "time"

    gomcp "github.com/modelcontextprotocol/go-sdk/mcp"
)

type ExampleInput struct {
    Anchor string `json:"anchor" jsonschema:"Node ID to operate on"`
    Budget int    `json:"budget,omitempty" jsonschema:"Token budget for the response"`
}

func (d *Deps) HandleExample(ctx context.Context, _ *gomcp.CallToolRequest, input ExampleInput) (_ *gomcp.CallToolResult, _ any, err error) {
    defer d.logCall("MemoryExample", &err, time.Now(), "anchor", input.Anchor, "budget", input.Budget)

    // Write-side tools take the lock; read-side tools do not (see "Locking" below).
    // d.Store.OpMu.Lock()
    // defer d.Store.OpMu.Unlock()

    result, err := d.Engine.DoSomething(ctx, input.Anchor, input.Budget)
    if err != nil {
        return nil, nil, fmt.Errorf("failed to do-something: %w", err)
    }

    d.boostResultNodes(ctx, result)         // read tools only

    return &gomcp.CallToolResult{
        Content: []gomcp.Content{&gomcp.TextContent{Text: result.Format()}},
    }, nil, nil
}

Five things every tool gets right:

  1. Named return values for the deferred logger. (_ *gomcp.CallToolResult, _ any, err error) is the SDK signature; the err name is required so defer d.logCall(..., &err, ...) can capture the final error. Renaming or omitting err silently breaks call logging.
  2. defer d.logCall(...) on the first line. Prefix the tool name with Memory to match the registered name. Pass enough attrs to debug a misbehaving call (anchor, budget, payload byte-count — never the full payload).
  3. Locking decision (see below).
  4. Error wrapping. Action errors take failed to <verb>: per go-concise.md §5; wrap the engine/store error with %w so callers can errors.Is.
  5. Return *mcp.CallToolResult with text content. Format complex results into one string before returning — clients render text, not structured JSON.

Locking

The store uses a single sync.Mutex exposed as Store.OpMu (memory: "no wrapper methods around sync primitives"). The rule:

Tool kindTake OpMu
Read-only (MemorySearch, MemoryFetch, MemoryTree, MemoryDelta, MemoryHistory, MemoryRelated)No
Mutating (MemoryWrite, MemorySummarize, MemoryCompile, MemoryRelate)Yes

Mutating tools call d.Store.OpMu.Lock() immediately after the deferred logger and defer d.Store.OpMu.Unlock(). See pkg/mcp/tools/summarize.go:21-22 and write.go:24-25 for the canonical pattern.

Read tools also call d.boostResultNodes(ctx, result) to bump temperature on accessed nodes — mutating tools do not (the write itself is the access).

The registration entry

Open pkg/mcp/server.go:146-186 (the registerTools function) and add:

go
mcp.AddTool(srv, &mcp.Tool{
    Name:        "MemoryExample",
    Description: "<one short sentence — what it does, not how>",
}, d.HandleExample)

Keep the name Memory<Verb> so it sorts cleanly with the existing inventory and matches the defer d.logCall(...) argument.

The test

pkg/mcp/tools/tools_test.go uses the in-process MCP transport via internal/mcptest.NewEnv(t). Call your tool through the client session and assert on the text output:

go
func TestExample_HappyPath(t *testing.T) {
    env := mcptest.NewEnv(t)
    res := env.CallTool(t, "MemoryExample", map[string]any{
        "anchor": "<seeded-id>",
        "budget": 500,
    })
    text := env.TextContent(t, res)
    if !strings.Contains(text, "<expected substring>") {
        t.Fatalf("unexpected output: %s", text)
    }
}

The docs sync — easy to skip, easy to regret

Two public skills under skills/ are the contract with future Claude sessions about what tools exist. Pick the one that matches the tool's side:

Tool kindSkill to update
Read (MemoryTree, MemorySearch, MemoryFetch, MemoryDelta, MemoryHistory, MemoryRelated)skills/remind/SKILL.md
Write (MemoryWrite, MemorySummarize, MemoryCompile, MemoryRelate)skills/memorize/SKILL.md
Crosses the boundary (introduces a new mental-model concept used on both sides)Both

For each affected skill, when you add a tool:

  1. Update the frontmatter description tool list.
  2. Update the opening / inventory paragraph to reflect the new surface.
  3. Add at least one example call into the relevant pattern section.

Skipping this means future sessions won't know the tool exists. The skills are the API contract, not just docs.

Show full SKILL.md (257 more words)Show less

Quick reference

1. pkg/mcp/tools/<tool>.go        (Input struct + Handle method on *Deps)
2. pkg/mcp/server.go              (mcp.AddTool entry in registerTools)
3. pkg/mcp/tools/tools_test.go    (env := mcptest.NewEnv(t); env.CallTool(...))
4. skills/remind/SKILL.md   (read tools)
   OR
   skills/memorize/SKILL.md          (write tools)
   OR both, when the change crosses the read/write boundary
5. go test ./pkg/mcp/...          (must pass)

Common mistakes

  • Read tool that mutates. If your tool mutates (even just bumping temperature), it must take OpMu. The temperature boost in boostResultNodes is the one exception — it goes through Tracker.RecordAccess → BoostTemperatureBatch, which serializes through SQLite's WAL writer, not the in-memory mutex.
  • Forgetting the named err return. defer d.logCall(..., &err, ...) captures err by pointer. If the function signature uses an unnamed error or shadows err with :=, the deferred log shows <nil> for failed calls.
  • Returning nil, nil, nil on the no-result path. Return an empty *mcp.CallToolResult with a text body like "no results" — clients expect text, not a missing content array. See pkg/mcp/tools/search.go and the query.FormatCompact "no results" string.
  • Passing the raw payload as a log attr. Use byte-count ("payload_bytes", len(input.Payload)) — payloads can be MB, and slog will serialize the whole thing.
  • Skipping the public-skill update. Tool exists in code but invisible to agents. Read tools must show up in skills/remind/SKILL.md; write tools in skills/memorize/SKILL.md. Test: a fresh session reading the relevant skill should be able to use the new tool from the description alone.

Cross-references

  • .claude/rules/go-concise.md — error wrapping, naming, locking discipline, no-wrapper-methods rule
  • .claude/rules/git-versioning.md — one commit per logical change; the four code edits ship together as feat(mcp): add MemoryExample tool, the docs sync as a follow-up docs(skill): document MemoryExample if it grew large, otherwise bundled
  • .claude/skills/add-store-query/SKILL.md — if the new tool needs a query the store doesn't have yet, do that skill first
  • skills/remind/SKILL.md — docs target for read-side tools (MemoryTree, MemorySearch, MemoryFetch, MemoryDelta, MemoryHistory, MemoryRelated)
  • skills/memorize/SKILL.md — docs target for write-side tools (MemoryWrite, MemorySummarize, MemoryCompile, MemoryRelate)

© radimsem, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .claude/skills/add-mcp-tool of radimsem/remindb.

Open the folder on GitHubat commit 977b31c

Compare with similar skills

Add an MCP Tool to remindb next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Add an MCP Tool to remindb compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Add an MCP Tool to remindb this skillradimsem/remindb129—~2.1kAutomated safety check: PassMIT
Local DevSmilyOrg/photofield608—~2.4kAutomated safety check: PassMIT
MemPalace Setup and OperationMemPalace/mempalace59k—~2.2kAutomated safety check: PassMIT
agentmemory Setup and Diagnosticsrohitg00/agentmemory29k—~1kAutomated safety check: NotesApache-2.0
Qmdbreferrari/obsidian-mind5k—~1.7kAutomated safety check: PassMIT
Memori MCP Memory UsageMemoriLabs/Memori17k—~3.8kAutomated safety check: PassMIT

Similar skills

  • Local Dev

    SmilyOrg/photofield

    Run, test, and debug the photofield server locally. An agent skill from SmilyOrg/photofield.

    608 GitHub stars~2.4k tokensUpdated 1 mo ago
    Agent WorkflowsAuto-check passed
  • Installs and configures MemPalace as a private local palace, a shared-brain hub or a client of an existing hub, including MCP registration and version-correct initialization.

    59k GitHub stars~2.2k tokensUpdated yesterday
    Agent WorkflowsAuto-check passed
  • Sets up and troubleshoots a local agentmemory install, covering the MCP connection, environment variables, ports, authentication and optional feature flags.

    29k GitHub stars~1k tokensUpdated today
    Agent WorkflowsAuto-check: notes
  • Qmd

    breferrari/obsidian-mind

    Search the vault using QMD semantic search. An agent skill from breferrari/obsidian-mind.

    5k GitHub stars~1.7k tokensUpdated 3 days ago
    Agent WorkflowsAuto-check passed
  • Memori MCP Memory Usage

    MemoriLabs/Memori

    Teaches an MCP-connected agent when and how to call Memori's recall, summary, compaction, augmentation, feedback and quota tools to keep context across sessions.

    17k GitHub stars~3.8k tokensUpdated 6 days ago
    Agent WorkflowsAuto-check passed
  • Queries a shared knowledge store before acting, proposes newly discovered insights, and confirms or flags existing entries, so agents stop rediscovering the same failures.

    1.3k GitHub stars~6.5k tokensUpdated 3 days ago
    Agent WorkflowsAuto-check passed

More from radimsem/remindb

All 11 skills in this repo
  • remindb Memory Writer

    radimsem/remindb

    Guides an agent writing to a remindb memory server: structured notes go in as files parsed into a node tree, single text facts go in through MemoryWrite.

    129 GitHub stars~2k tokensUpdated 2 mo ago
    Auto-check passed
  • remindb Read Path

    radimsem/remindb

    Covers the read-side tools of the remindb MCP server, a SQLite-backed agent memory, for orienting, searching, resyncing and tracing relations.

    129 GitHub stars~2.7k tokensUpdated 2 mo ago
    Auto-check passed
  • Adds a new row to remindb's token-savings benchmark table by writing a scenario function that measures the naive shell-tool token cost against the remindb tool-call cost for the same task.

    129 GitHub stars~1.7k tokensUpdated 2 mo ago
    Auto-check passed
  • Adds a new Go fuzz target to remindb following its seed-corpus discipline: one target per logical surface, discovered automatically by its FuzzXxx function name.

    129 GitHub stars~1.7k tokensUpdated 2 mo ago
    Auto-check passed
  • Explains how to add an end-to-end test scenario to remindb, choosing between a direct API test and an MCP test and using the shared helpers and fixtures.

    129 GitHub stars~1.8k tokensUpdated 2 mo ago
    Auto-check passed
  • Add a remindb Parser

    radimsem/remindb

    Walks through adding a new file format to remindb's Go parser package: the parser file, the ParseBytes case, table tests and fuzz seeds.

    129 GitHub stars~1.6k tokensUpdated 2 mo ago
    Auto-check passed

Questions about Add an MCP Tool to remindb

What does Add an MCP Tool to remindb do?

Checklist for adding a new Memory-prefixed tool to remindb's Go MCP server: tool file, registration, test, skill docs, plus the locking and logging rules. Each tool is a file in pkg/mcp/tools, written as a method on the Deps type that takes a typed input struct, calls into the Store, Engine or Tracker and returns a call result with text content.go using the mcptest environment, and an update to the remind or memorize skill's tool inventory.

When should I use Add an MCP Tool to remindb?

Add an MCP Tool to remindb fits situations like: exposing a new capability to MCP clients in remindb; registering a new MemoryXxx tool in registerTools; deciding whether a new tool needs to take the store lock; adding tests and skill inventory entries for a new tool.

How do I install Add an MCP Tool to remindb in Claude Code?

Run `npx skills add radimsem/remindb --skill add-mcp-tool -a claude-code`. Or copy the skill folder (.claude/skills/add-mcp-tool in radimsem/remindb) into .claude/skills/add-mcp-tool in your project. Claude Code loads it when a task matches its description.

How do I install Add an MCP Tool to remindb in Codex?

Run `npx skills add radimsem/remindb --skill add-mcp-tool -a codex`. Or copy the skill folder (.claude/skills/add-mcp-tool in radimsem/remindb) into .agents/skills/add-mcp-tool in your project. Codex loads it when a task matches its description.

Can I use Add an MCP Tool to remindb in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add radimsem/remindb --skill add-mcp-tool -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/add-mcp-tool, .gemini/skills/add-mcp-tool, .github/skills/add-mcp-tool and .opencode/skills/add-mcp-tool in your project.

What does Add an MCP Tool to remindb need to run?

SKILL.md names no scripts, command-line tools or credentials: Add an MCP Tool to remindb is instructions for the agent only. Our summary lists: A checkout of the remindb repository and a Go toolchain.

Does Add an MCP Tool to remindb access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Add an MCP Tool to remindb safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Add an MCP Tool to remindb use?

Add an MCP Tool to remindb is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Add an MCP Tool to remindb use?

About 2.1k tokens (SKILL.md is roughly 8.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Add an MCP Tool to remindb?

Skills that share tags, products or a category with Add an MCP Tool to remindb: Local Dev (SmilyOrg/photofield, 608 stars), MemPalace Setup and Operation (MemPalace/mempalace, 59k stars), agentmemory Setup and Diagnostics (rohitg00/agentmemory, 29k stars) and Qmd (breferrari/obsidian-mind, 5k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Add an MCP Tool to remindb?

radimsem (a GitHub user) maintains it in radimsem/remindb, which has 129 GitHub stars. The repository holds 11 skills in this directory. The repository was last updated on August 3, 2026.

Source: radimsem/remindb on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.