IF Commons GitHub

surfaces/mcp/tools

Written to: 3 requirements: 3 proved, 0 partly, 0 failing, 0 with no test recorded. 0013-mcp-surface FR-001, 0013-mcp-surface FR-005, 0013-mcp-surface FR-002

The tools of a tool server, generated from governance (commons headless 0013-mcp-surface FR-001): one tool for each command of the program that the caller's tier may see, that may come through the mcp channel and that is not for a person alone, with a JSON Schema made from the command's options and operands and the hints a client needs (readOnlyHint, destructiveHint, idempotentHint). Pure: the same program and tier give the same tools, in the order of the tree.

What a person alone may give (humanOnly options) is absent from the schema, so is every standard option of the command line but --dry-run and --check (the surface decides the rest: it never asks, takes no --yes, and wants the JSON document); the schema and the argument vector are the logical layer's (machine-args), shared with the REST surface.

import { toolName } from "./tools.ts";
toolName("archon", ["server", "dry-list"]); // "archon_server_dry_list"

Source: commons/headless/src/surfaces/mcp/tools.ts

2 of 7 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.

McpTooltypeno test imports it
type McpTool = { readonly name: string; readonly title: string; readonly description: string; readonly inputSche… (477 characters)
type McpTool = {
  readonly name: string;
  readonly title: string;
  readonly description: string;
  readonly inputSchema: {
    readonly type: "object";
    readonly properties: { readonly [argument: string]: ArgSchema };
    readonly required: readonly string[];
    readonly additionalProperties: false;
  };
  readonly annotations: { readonly readOnlyHint: boolean; readonly destructiveHint: boolean; readonly idempotentHint: boolean; readonly openWorldHint: boolean };
};

A tool, as tools/list returns it.

toolNamefunction
function toolName(program: string, path: readonly string[]): string

The name of the tool of a command: the program's name and its words joined by underscores (archon_server_list).

Imported by 6 tests of the run (6 passed, 0 failed): the library's results

listablefunctionno test imports it
function listable(p: Placed): boolean

Whether a command may be a tool: it may come through the mcp channel and it is not for a person alone.

toolOffunctionno test imports it
function toolOf(program: string, p: Placed): McpTool

The tool of one command.

Servedtypeno test imports it
type Served = { readonly tool: McpTool; readonly placed: Placed };

A tool and the command it is of.

ToolProblemtypeno test imports it
type ToolProblem = { readonly rule: "mcp/name-collision"; readonly name: string; readonly ids: readonly string[] };

What is wrong with the tools of a program.

servedfunction
function served(program: Program, tier: TierName): Result<readonly Served[], readonly ToolProblem[]>

The tools a caller of a tier is served, each with its command, or the names that two commands would share.

Imported by 17 tests of the run (17 passed, 0 failed): the library's results

Titles, headings, exports, tables, columns and requirements. Esc closes.