Skip to content
Back to skills

Rule Mcp Tools

ASecurity

geniro's own MCP tools — one module, one directory per tool, a shared base class and interface. A repository rule for apps/daemon/src/v1/mcp/**, apps/daemon/src/v1/agents/utils/host-*.ts; read it before editing a file there.

  • 8 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added November 9, 2026
ai-agentsrustgonodeawsgitapidatabase

Works with

  • cli
  • api
  • mcp

Security analysis

A100/100

Scanned December 4, 2026

npx -y skills add geniro-io/geniro-app --skill rule-mcp-tools --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Rule Mcp Tools?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Rule Mcp Tools
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/geniro-io-rule-mcp-tools/badge)](https://www.skillsdirectory.com/skills/geniro-io-rule-mcp-tools)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: rule-mcp-tools
description: "geniro's own MCP tools — one module, one directory per tool, a shared base class and interface. A repository rule for apps/daemon/src/v1/mcp/**, apps/daemon/src/v1/agents/utils/host-*.ts; read it before editing a file there."
---
<!-- GENERATED by scripts/sync-agent-rules.mjs from .claude/rules/mcp-tools.md. DO NOT EDIT: edit the source, then run `pnpm sync:agent-rules`. -->

# geniro's MCP tools

Every tool geniro's own MCP endpoint serves (`call_agent`, `show_chart`, `propose_plan`, …) lives in `apps/daemon/src/v1/mcp/tools/<tool-name>/`, in the same shape, extending the shared base class. This applies to editing a tool as much as adding one. (A CLI's slash-command skills, `SkillsService`, are not covered.)

## One tool's directory

`tools/<tool-name>/`, kebab-cased from the wire name (`show_chart` → `show-chart/`), holds exactly:

- `<tool>.tool.ts` — the class: `name`, when it is offered, what a call does. No prose, no schema.
- `<tool>.instructions.ts` — `export function <tool>Instructions(…): string`, the description a model reads.
- `<tool>.schema.ts` — `export function <tool>Schema(…): Record<string, unknown>`, the input schema with field descriptions (a function, so each listing gets a fresh object).
- `<tool>.reader.ts` — reads the model's arguments defensively (never throws; every tool's zod argument reader is `tools/tool-args.ts`) and words the result; spec beside it as `<tool>.reader.spec.ts`.

Instructions and schemas are `.ts`, never `.md` or `.json` — swc copies nothing else into `dist/`, so they would silently be missing from a packaged daemon. Values the text needs are function parameters or imports, never load-time placeholders.

## Base classes

- `McpTool` (`mcp.types.ts`) is the contract: `handles`, `list`, `call`.
- Extend `BaseMcpTool` (`tools/base-mcp-tool.ts`): fill `isOffered`, `instructions`, `inputSchema`, `run`; answer through `this.text(…)` / `this.invalidArgs(…)`. Never override `list` or `call`.
- A call that failed inside geniro (storage, the database, a bridge) rather than being refused sets `McpToolResult.failure` (`timeout` or `internal`), whether its answer reads as an error or as an outcome, read from a structured mark, never from the message's wording. A broker or service that catches its own failure marks the outcome it returns (`failedInside` in `agents/services/host-sink.broker.ts`, which `HostSinkBroker.deliver` uses for a sink that threw, or `failure: 'internal'` on the outcome), and the tool answers through `this.answerTo(outcome, …)`, which carries the mark; a tool's own catch answers through `this.failedInGeniro(…)`. An agent's bad input is never marked: `INVALID_ARGS` and every refusal stay unmarked. `McpServerService` strips the mark from the wire and hands every answer, and a tool that threw, to `ToolFailureFlagsService`, which raises the daemon's own flag (`.claude/rules/daemon-host-tools-outcomes.md`).
- `CallMcpTool` is the base for agent-to-agent call-runtime tools (offered only to nodes with callees, answers via `envelope(…)`, waits via `waiting(…)`).
- `HistoryMcpTool` is the base for chat-history tools. They are never auto-approved and carry no `readOnlyHint` (codex skips approval for read-only tools). That rule is about reading saved chats: `read_command_center` (on `BaseMcpTool`, reusing `historyResultText` with its own data preface) reads only the live board the user already sees, is offered only on the command-center manager's turn, and is auto-approved there with the manager's other tools (`isHostCommandCenterCall`). One recorded exception: `read_analyzed_thread` (on `BaseMcpTool`, reusing the history preface) is auto-approved (`agents/utils/host-analysis.ts`) because it is installed only on an analysis chat and reads only what that analysis was started on — its one source thread, or the team it was started on: the runs the daemon sampled, and any other run of that team the agent names (user decision: everything of the team can be read, paying only for what is read; a card per page would make the analysis unusable, and the user already pressed Analyze on that team or opened its builder). The slug is the daemon's and `ThreadReaderService.readSourceOf` holds each named run to it, so another team's run, a deleted run and a chat of no team stay refused, and a thread analysis keeps its one thread. Each is read up to its snapshot, beside the team's own ledger figures over its other runs (`view=history`, `view=spend`: no transcript text, no folder path), and `view=runs` / `view=pr` add the GitHub life of the pull requests those runs named, through the user's own `gh` (`.claude/rules/network-constraints.md`, item 1); it still carries no `readOnlyHint`, leads with the history preface and masks secrets.
- `MemoryMcpTool` is the base for the shared memory's tools (`memory_search`, `memory_read`, `memory_save`, `memory_forget`, `memory_feedback`): offered on every endpoint while the user has memory on, refused `MEMORY_DISABLED` at call time once it is off, and given the run's project and the caller's identity by `MemoryService` (never by the arguments). They are auto-approved in chats and team nodes alike (`isHostMemoryCall`); the write limits live in `MemoryService`, not in the approval.
- `KnowledgeMcpTool` is the base for the knowledge store's tools (`knowledge_search`, `knowledge_read`, `knowledge_save`), on the same terms: offered while the user has knowledge on, refused `KNOWLEDGE_DISABLED` at call time once it is off, the run's place and the caller's identity from `KnowledgeService`, unless an analysis, builder or project chat names another place with `project` or `team` (the base takes them out of the arguments before the tool's own reader). A tool fills `ownInstructions` and `ownSchema`, and the base adds those two where they are offered. `knowledge_save` is unlisted while agents may only read. They are auto-approved (`isHostKnowledgeCall`); the write rules live in `KnowledgeService`.
- `ResourceCardTool` (`tools/resource-card-tool.ts`) is the base for the resource tools (`save_project`, `delete_project`, `save_label_instructions`, `delete_label_instructions`, `save_group`, `delete_group`, `delete_team`, `import_team`, `export_team`, `delete_plugin`, `save_settings`): a tool supplies its name, reader, instructions and schema; the base offers it wherever `ResourceCardBroker` has a sink (a chat's turn, a team lead in its own conversation), lets the owning module's `ResourceCardAdapter` (registered with `ResourceCardService`, since `v1/agents` imports none of those modules) run the write's own checks and build the card — a write that would fail is refused with no card — and parks on the card in every approval mode. Only the card's press writes, through that adapter, which re-checks what the card pinned and answers `not-saved` for a target that moved. Calling one is auto-approved (`isHostResourceCall`), the card being the gate. A card a module writes in the daemon (`ResourceCardService.write`) runs on the press; a `save_settings` card is written by the window instead (settings.json is Electron main's), so its write waits for that window's `card_report` WebSocket message (`CardReportsService.waitFor`, accepted only from the socket whose verdict was `applied`) and answers `not-saved` when none arrives in `CARD_REPORT_WAIT_MS` (`apps/ui/src/main/AGENTS.md` → Settings an agent's card changes). A card names a CLI profile only through `ResourceCardService.profileName` (the user's name from the settings snapshot, else the folder's name), and the agent sends a profile only as a `<set:digest>` token. A card carries a stored enum as stored, marked with its `vocabulary` (`lineVocabulary` for a `Label: value` line), and the renderer words it from the label the app's own screen uses (`valueWordOf` in `resource-change-card.tsx`), never a copy of it in the daemon; a field that holds nothing reads `RESOURCE_CARD_UNSET` (—), and `default` only where the app picks the value.
- `BrowserTool` (`tools/browser-shared/browser-tool.ts`) is the base for the in-app browser's seventeen `browser_*` tools: offered while `BrowserBroker.canDrive`, each call run through the broker under `whileCancellable`, its outcome worded once (`readsPage` adds the untrusted-page-content preface). `tools/browser-shared/` holds that base and the family's shared readers and wording, and is the one directory under `tools/` that is not a tool.
- A tool that waits on a person runs the wait through `context.whileCancellable(…)`.
- The only tool not on `BaseMcpTool` is `tools/board/board.tools.ts` (the tasks module owns those tools and this module may not import it). Do not add a second exception.

## Code mode (`execute`)

- With the Settings switch on `code` (`GeniroToolsModeService`, the default), `tools/list` offers only `execute` (`tools/execute/`); every other tool is listed only on `classic` (`gatedForToolsMode`, applied once in `createMcpTools`, never per tool). A call by name still goes through.
- Every tool a caller would be listed is automatically a function `geniro.<name>(input)` of the script (`code-mode/api-catalog.ts`, read off each tool's own `list`), so a new tool needs nothing extra and a tool's wire name is its function name — never rename one without the preamble and the scripts in mind.
- A script's call goes through `serveToolCall` (`utils/serve-tool-call.ts`), the same pipeline as a CLI's own call (failure flags, usage signal), and is held to the run's own approval rule through the `CodeModeSink` the turn lends (`agents/services/code-mode.broker.ts`): true runs it, false refuses it, null raises the ordinary approval card. Never add a second policy for scripts.
- The sandbox (`code-mode/script-sandbox.ts`) is QuickJS in a worker thread, one fresh worker per script, with `geniro` and `console` only: never give it fs, network, process, timers or module loading.
- A script receives a tool's answer as data (`code-mode/script-result.ts`): a tool that returns data answers with JSON, or a note and then its JSON running to the end of the text from the start of a line (`withJson`, `historyResultText`). Keep that shape; never put text after the JSON.
- Inner rows carry `parentCallId` (the `execute` tool_call id), never `parentToolUseId`, which means a sub-agent's child everywhere.
- `execute` takes an optional one-line `description` (at most `EXECUTE_DESCRIPTION_MAX_CHARS`), which the renderer draws as the script card's title (`chats/script-describe.ts` words a script without one from its calls); its instructions and the code-mode preamble tell agents to always give it. An approval card a script's call raises carries it as `scriptPurpose`, drawn above the card in the thread and the Needs you gallery.

## Adding a tool

1. Name it as `HOST_<NAME>_TOOL` in `agents/chat.types.ts` if anything outside `v1/mcp` (the permission gate, the renderer) must recognise it.
2. Write the four files; the class extends `BaseMcpTool` or `CallMcpTool`.
3. Register it in `createMcpTools` (`tools/mcp-tools.ts`) — the one place the `tools/list` order is set, and the order is part of what a model reads. New dependencies go in `McpToolDeps` and the `MCP_TOOLS` factory in `mcp.module.ts`.
4. Auto-approval (only when calling it is not itself a decision): an `isHost<Name>Call` predicate in `agents/utils/host-<name>.ts` over `isHostToolCall`, used by `ChatService`'s `autoApproves`. Predicates and any reader `v1/agents` needs stay in `agents/utils`, because `v1/agents` may not import `v1/mcp`.
5. Renderer: a tool whose call row the transcript hides goes in `GENIRO_TOOLS` (`apps/ui/src/renderer/chats/geniro-tool.ts`) — an unchecked map, easy to miss. A call tool also goes in `GENIRO_MCP_CALL_TOOLS` (`agents/adapters/adapter.types.ts`).
6. Description audit (`mcp-server.service.spec.ts`): a tool overlapping another names it in its instructions and is named back; every tool says when to use it; every card tool says when not to.
7. The system instructions: name the tool in `GENIRO_UI_PREAMBLE`'s "Geniro's own tools" section (`agents/utils/agent-instructions.ts`) by the situation it is for, in the same change — claude lists MCP tools by name only, so the preamble is where an agent learns when a tool is the move. Add its `HOST_*` constant to the wire-name list in `agent-instructions.spec.ts`. Only a tool something else already explains (a companion named in another tool's description, or one offered only where a brief names it) is exempted instead, in `PREAMBLE_EXEMPT` (`mcp-server.service.spec.ts`) with that reason; that spec fails on a listed tool that is neither.

## Changing a tool

- Instructions and schema are what every model reads: change wording deliberately and re-run the description audit.
- A tool whose purpose changes, or that is renamed or removed, changes its preamble line in the same change.
- A refactor meant to change nothing must leave `tools/list` and call results byte-identical — prove it by capturing them before and after.
- Reader tests live in `<tool>.reader.spec.ts`; cross-tool behaviour (listing, dispatch, cancellation) in `mcp-server.service.spec.ts`.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.