import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js"; import * as z from "zod/v4"; import { GlitchClient } from "./glitchClient.js"; type RawShape = z.core.$ZodShape; /** * Per-call runtime context exposed to tool handlers. * * Lets long-running tools stream live progress and log lines back to the client * (a richer experience in Codex/Cursor/Claude Code) and observe cancellation. * All emitters are best-effort no-ops when the client did not request them. */ /** A single field requested in an elicitation prompt. */ export interface ElicitProperty { readonly type: "string"; readonly title?: string; readonly description?: string; readonly enum?: string[]; readonly enumNames?: string[]; readonly default?: string; } export interface ElicitSchema { readonly type: "object"; readonly properties: Record; readonly required?: string[]; } export interface ElicitOutcome { /** "unsupported" means the client cannot show prompts; callers should fall back. */ readonly action: "accept" | "decline" | "cancel" | "unsupported"; readonly content?: Record; } export interface ToolRuntimeContext { readonly signal?: AbortSignal; /** True when the client can receive progress/log notifications. */ readonly streamingEnabled: boolean; /** True when the client declared the MCP elicitation capability (interactive prompts). */ readonly canElicit: boolean; log(level: "debug" | "info" | "warning" | "error", message: string): Promise; progress(progress: number, total: number | undefined, message?: string): Promise; /** Ask the user a structured question (multiple choice / free text). */ elicit(request: { message: string; requestedSchema: ElicitSchema; }): Promise; } export interface GlitchToolDefinition { readonly name: string; readonly title: string; readonly description: string; readonly inputSchema: RawShape; readonly readOnlyHint?: boolean; readonly destructiveHint?: boolean; readonly idempotentHint?: boolean; readonly uiResourceUri?: string; readonly handler: (client: GlitchClient, input: Record, ctx?: ToolRuntimeContext) => Promise; } export declare const glitchToolDefinitions: readonly GlitchToolDefinition[]; export declare function registerGlitchTools(server: McpServer, client: GlitchClient): void; export {};