export interface ToolAnnotation { readOnlyHint?: boolean; destructiveHint?: boolean; idempotentHint?: boolean; openWorldHint?: boolean; } export type ToolSchema = { type?: 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object'; properties?: Record; items?: ToolSchema; required?: string[]; examples?: unknown[]; allOf?: ToolSchema[]; anyOf?: ToolSchema[]; oneOf?: ToolSchema[]; not?: ToolSchema; if?: ToolSchema; then?: ToolSchema; else?: ToolSchema; enum?: unknown[]; const?: unknown; minLength?: number; maxLength?: number; minItems?: number; maxItems?: number; minimum?: number; maximum?: number; pattern?: string; additionalProperties?: boolean; description?: string; default?: unknown; }; export type ToolInputSchema = ToolSchema & { type: 'object'; properties: Record; }; export type ToolOutputSchema = { type: 'object'; properties: Record; required?: string[]; additionalProperties?: boolean; }; export interface ToolDefinition { name: string; title?: string; description: string; inputSchema: ToolInputSchema; annotations?: ToolAnnotation; } export type ListedToolDefinition = ToolDefinition & { title: string; outputSchema: ToolOutputSchema; }; export type RenderOptions = { detailLevel?: 'default' | 'more' | 'full'; } & Record; export type TransportDetailLevel = 'default' | 'more' | 'full'; export interface ToolContract { definition: ToolDefinition; execute: (input: TInput) => TOutput | Promise; renderText: (result: TOutput, options?: TOptions) => string; renderJSON: (result: TOutput, options?: TOptions) => unknown; outputSchema: ToolOutputSchema; mergeRuntimeExtras?: (canonicalJSON: unknown, rawResult: unknown) => unknown; /** 详查工具:在 base 工具的完整输入上追加 selector 查询参数,对同一张盘做局部深查 */ derivesFrom?: DerivedToolSource; } export interface DerivedToolSource { base: string; selector: ToolInputSchema; } export declare function defineToolContract(contract: ToolContract): ToolContract; /** 详查工具自己的详略:只决定文本是否附带判定口径,结构化结果不分详略 */ export declare const DERIVED_DETAIL_LEVEL_SCHEMA: ToolSchema; /** * 合并 base 输入与 selector:属性不得重名,required 取并集,根约束收进 allOf。 * 示例按下标配对,保证每个公开示例都能直接执行。 */ export declare function composeInputSchema(base: ToolInputSchema, selector: ToolInputSchema): ToolInputSchema; export interface DerivedToolSpec { base: ToolContract; name: string; description: string; selector: ToolInputSchema; derive: (baseOutput: TBaseOutput, selector: TSelector, baseInput: TBaseInput) => TOutput | Promise; renderText: (result: TOutput, options?: TOptions) => string; renderJSON: (result: TOutput, options?: TOptions) => unknown; outputSchema: ToolOutputSchema; } /** 按 selector 的属性名把详查输入拆回 base 输入与查询参数;只影响渲染的字段两边都不给 */ export declare function splitDerivedInput(selector: ToolInputSchema, input: Record): { baseInput: Record; selection: Record; }; export declare function defineDerivedToolContract(spec: DerivedToolSpec): ToolContract; export declare function normalizeTransportDetailLevel(detailLevel: unknown): TransportDetailLevel; export declare function mergePlaceResolutionInfo(canonicalJSON: unknown, rawResult: unknown): unknown; //# sourceMappingURL=contract.d.ts.map