Files
reverse-engineering-anything/src/contracts/toolContractTypes.ts
T
morluto b8a9da0c0f refactor(mcp): make analysis states unrepresentable (#468)
* refactor(config): parse capability settings into exact states

* refactor(runtime): encode replay and process outcomes exactly

* refactor: make analysis states unrepresentable

* refactor(mcp): register canonical schemas with SDK

* fix: preserve capability and catalog invariants

* fix(build): remove stale compiled modules

* fix(replay): update real verifier policy dependency

* fix(package): verify the complete MCP catalog

* fix(test): supply complete replay reload policy

* refactor(contracts): centralize output schema lookup

* refactor(mcp): delegate protocol boundaries to SDK

* fix(browser): approve real source capture

* fix(mcp): preserve catalog guidance
2026-08-10 02:28:11 +08:00

57 lines
1.6 KiB
TypeScript

import type { z } from "zod";
import type { JsonValue } from "../domain/jsonValue.js";
import type { ToolEffects } from "./toolEffects.js";
/** Caller-visible MCP execution hints. */
interface ToolAnnotations {
readonly readOnlyHint: boolean;
readonly destructiveHint: boolean;
readonly idempotentHint: boolean;
readonly openWorldHint: boolean;
}
/** One validated example request for an MCP tool contract. */
export interface ToolExample {
readonly title: string;
readonly input: Readonly<Record<string, JsonValue>>;
}
/** Canonical adapter families responsible for public MCP tools. */
export const TOOL_KINDS = [
"official-proxy",
"enhanced",
"native-provider",
"artifact-provider",
"managed-provider",
"browser-provider",
"electron-provider",
"runtime-provider",
"application",
"session",
] as const;
/** Adapter family responsible for implementing a public MCP tool. */
export type ToolKind = (typeof TOOL_KINDS)[number];
/** Single source of truth for a public MCP tool. */
export interface ToolContract<
Name extends string = string,
InputSchema extends z.ZodType<Readonly<Record<string, unknown>>> = z.ZodType<
Readonly<Record<string, unknown>>
>,
OutputSchema extends z.ZodType<Readonly<Record<string, unknown>>> = z.ZodType<
Readonly<Record<string, unknown>>
>,
> {
readonly name: Name;
readonly title: string;
readonly description: string;
readonly kind: ToolKind;
readonly inputSchema: InputSchema;
readonly outputSchema: OutputSchema;
readonly effects: ToolEffects;
readonly annotations: ToolAnnotations;
readonly examples: readonly ToolExample[];
}