/** * MCP tool identity and class (DES-MCP-TOOLS-001 §4.2, §5). * * - The SUBJECT is the policy token a tool is judged by: `mcp:/`. A server name * never contains `/`, so the first `/` after `mcp:` always splits it. * - The CLASS comes from the tool's own `tools/list` annotations, never from a carrier (F-2): * an operator override wins; else `read` when `readOnlyHint === true`; else `destructive` when * `destructiveHint !== false` (the MCP spec default); else `write`. A tool with NO annotations * is `write` (D-4). * - The SCHEMA HASH covers everything a policy or an operator approved: description, input and * output schema, annotations, and a `rest` tool's request mapping and target (G2). Any change sends the tool back to unregistered (D-5) until it * is previewed and saved again. */ import type { McpRestMapping, McpToolAnnotations, McpToolClass } from '../core/types.js'; /** A server name: a lowercase token that is safe inside `mcp:/` and a keychain account. */ export declare const MCP_SERVER_NAME_RE: RegExp; /** The reserved server name of the broker's estate relay (wicked-core#1018, `estate-relay.ts`): * `mcp:estate/` never reaches a registered server, and no server may be saved under it. */ export declare const ESTATE_SERVER = "estate"; export declare function mcpSubject(server: string, tool: string): string; /** `mcp:/` → its parts, or `null` for anything else. */ export declare function parseMcpSubject(subject: string): { server: string; tool: string; } | null; /** * The class `tools/list` annotations imply (§4.2), exactly as the engine's `mcp_gate::classify` * derives it (`tests/mcp-policies.test.ts` pins the two against each other): `null` annotations, or * annotations carrying neither `readOnlyHint` nor `destructiveHint`, = none declared = `write` (D-4). */ export declare function deriveToolClass(annotations: McpToolAnnotations | null): McpToolClass; /** The class a policy sees: the operator's override when set, else the derived one. */ export declare function effectiveToolClass(derived: McpToolClass, override: McpToolClass | null): McpToolClass; /** JSON with object keys sorted at every depth, so a hash never depends on key order. */ export declare function canonicalJson(value: unknown): string; export declare function sha256Hex(text: string): string; /** The fields of a listed tool the schema hash covers. */ export interface HashedToolShape { name: string; description: string | null; inputSchema: Record | null; outputSchema: Record | null; annotations: McpToolAnnotations | null; /** A `rest` tool's request mapping: part of what was approved, so a changed mapping re-registers. */ rest?: McpRestMapping | null; } /** * (G2, DES-data-connectors §3) What a `rest` tool's calls go to: the base URL's origin and path and * the header its secret rides in. Part of a REST tool's hash, so a changed target re-registers the * tool (D-5) and withdraws its approvals until it is previewed and saved again. */ export interface HashedRestTarget { origin: string; basePath: string; authHeader: string | null; } export declare function toolSchemaHash(tool: HashedToolShape, target?: HashedRestTarget | null): string; //# sourceMappingURL=classify.d.ts.map