UNPKG

histoire

Version:

A fast story book powered by Vite

40 lines • 2.22 kB
import type { McpServer } from '@modelcontextprotocol/server'; import type { HistoireMcpProject } from '../project/facade.js'; /** Exactly the read milestone tools, shared by both serving transports. */ export declare const MCP_READ_TOOLS: readonly ['histoire_get_project', 'histoire_list_stories', 'histoire_get_story', 'histoire_get_docs', 'histoire_get_source', 'histoire_get_preview']; /** Exact public read name; resource facade reads do not invoke this hook. */ export type McpReadToolName = typeof MCP_READ_TOOLS[number]; /** Dev observer receives scoped identifiers and a closure, never full arguments. */ export type McpReadToolObserver = <T>(name: McpReadToolName, target: { storyId: string; variantId?: string; } | undefined, run: () => T) => T; /** Project expected domain failures to one tool result adapter. */ export declare function readToolResult(read: () => unknown | Promise<unknown>): Promise<{ content: { type: 'text'; text: string; }[]; structuredContent: { ok: true; data: unknown; }; } | { isError: true; content: { type: 'text'; text: string; }[]; structuredContent: { ok: false; error: { code: "ARTIFACT_NOT_FOUND" | "BROWSER_UNAVAILABLE" | "CANCELLED" | "CAPABILITY_UNAVAILABLE" | "COLLECTION_FAILED" | "CURSOR_EXPIRED" | "DEPENDENCY_MISSING" | "DOCS_NOT_FOUND" | "INTERNAL_ERROR" | "INVALID_CURSOR" | "INVALID_SELECTOR" | "OPERATION_NOT_FOUND" | "PATH_OUTSIDE_ROOT" | "PREVIEW_NOT_READY" | "PROJECT_CLOSED" | "PROJECT_RESTARTING" | "PROJECT_STARTING" | "QUEUE_FULL" | "REQUEST_KEY_CONFLICT" | "RESULT_TOO_LARGE" | "SOURCE_UNAVAILABLE" | "STALE_REVISION" | "STORY_AMBIGUOUS" | "STORY_NOT_FOUND" | "TIMEOUT" | "VARIANT_NOT_FOUND"; message: string; retryable: boolean; details?: Record<string, import("zod").JSONType>; }; }; }>; /** Register only implemented read services, with strict input/output schemas. */ export declare function registerReadTools(server: McpServer, project: HistoireMcpProject, observeClientName?: (name: string) => void, observeReadTool?: McpReadToolObserver): void; //# sourceMappingURL=read-tools.d.ts.map