import { type MediaPurposePolicy, type SchemaManifest } from "@aotter/mantle-spec"; import type { RuntimeCallableCapability } from "../../domain/service/CallableCapabilityProjector.js"; /** * MCP tool catalog. Mix of generic lifecycle tools plus per-collection emitted authoring * tools (`create_draft_*` / `update_draft_*` for authored content, * `create_record_*` / `update_record_*` for operational records) * with the Schema's properties inlined into the tool's `inputSchema` * so MCP clients (LLM agents) see typed authoring contracts without * a separate `get_schema` round trip. * * Per-collection emission rules (POC ADR-0014 + PR #48 collision fix): * * - tool name suffix = `Schema.metadata.name` lowercased + `kebab-` * to-`snake_` (`post-translations` → `post_translations`) * - input schema = `Schema.spec.schema.properties` minus any * property carrying `x-mantle-bind` (those are server-stamped and * the agent must not send them) * - `required` = intersection of `Schema.spec.schema.required` with * the surviving authoring fields * - each update tool adds `id` + `expected_version` to the schema * and to `required` * - the dispatcher unwraps the typed top-level fields back into the * chokepoint's `data` arg — the wire surface is flatter than * `{ data: {...} }`, the storage shape is unchanged. * * Two Schemas that mangle to the same tool-name suffix (`foo-bar` and * `foo_bar` both → `foo_bar`) are caught at boot with * `MCP_TOOL_NAME_COLLISION`. */ export interface McpToolDefinition { readonly name: string; readonly title?: string; readonly description: string; readonly inputSchema: Record; /** MCP tool annotations (spec: absent hints default to the conservative * `destructiveHint: true` / `openWorldHint: true`). Only provable or * author-declared values are emitted (#972). */ readonly annotations?: McpToolAnnotations; } export interface McpToolAnnotations { readonly readOnlyHint?: boolean; readonly destructiveHint?: boolean; readonly idempotentHint?: boolean; readonly openWorldHint?: boolean; } /** Resolve each tool's declared correlation argument once at catalog build. */ export declare function buildMcpAuditOperationIdResolver(tools: readonly McpToolDefinition[]): (tool: string, args: Readonly>) => string | null; export declare const COMMIT_MEDIA_UPLOAD_TOOL: McpToolDefinition; export declare const GENERIC_TOOLS: readonly McpToolDefinition[]; export declare const CREATE_DRAFT_PREFIX = "create_draft_"; export declare const UPDATE_DRAFT_PREFIX = "update_draft_"; export declare const CREATE_RECORD_PREFIX = "create_record_"; export declare const UPDATE_RECORD_PREFIX = "update_record_"; export declare const QUERY_VIEW_PREFIX = "query_view_"; export type McpToolSurface = "staff" | "public"; /** * Build the full tool catalog from the manifest's Schemas. The * runtime constructs this once at boot (post-validation) and the * dispatcher reads it for `tools/list` + name-based routing. */ export interface BuildMcpToolCatalogOpts { /** When true, registers `create_media_upload` + `commit_media_upload`. * Adapters set this from the runtime's `media` field (non-null when * a `mediaStorage` was bound). */ readonly mediaEnabled?: boolean; /** Declared `siteDefaults.media.purposes`; when supplied, the * `create_media_upload` schema marks purpose as required and emits * this set as an enum so agents can self-correct from tools/list. * The policy summary (required mimes + per-mime byte caps) is also * inlined into the tool description so agents see the contract * without a separate `get_schema` round trip. */ readonly mediaPurposes?: readonly MediaPurposePolicy[]; /** Staff surface exposes authoring / lifecycle tools. Public * surface exposes only read-only View queries for v0.1. */ readonly surface?: McpToolSurface; /** Sealed-plan callable projection. The same descriptors drive * discovery and tools/call routing. */ readonly capabilities?: readonly RuntimeCallableCapability[]; } export declare function buildMcpToolCatalog(schemas: ReadonlyArray, opts?: BuildMcpToolCatalogOpts): readonly McpToolDefinition[]; export declare const CONTENT_LIFECYCLE_TOOLS: ReadonlySet; /** Re-export the naming util from `domain/service/` so existing * consumers of `McpToolCatalog` (the dispatcher) keep their import * surface stable. */ /** Inverse routing: given a tool name and its prefix, recover the * segment. Returns `null` if the name doesn't carry the prefix. */ export declare function extractCollectionSegment(toolName: string, prefix: string): string | null; //# sourceMappingURL=McpToolCatalog.d.ts.map