/** * The MCP tool contract: one source of truth for every transport. * * The stdio server and the Streamable HTTP server list tools from here. The * read-only tools (`catalog`, `search-catalog`, `describe`, `recipes`, * `recipe`, `validate`) are complete and pure, so both transports run the very same function. `render` * and `themes` differ only * in where their output goes or where presets come from, so this module owns * their descriptions, input schemas and result shapes, and each transport * supplies the side effect: a local file for stdio, a stored artifact for HTTP. * * No Node-only import is allowed here; the Worker bundles this module. */ import type { CompileResult } from '../render/render.js'; import type { ThemeCatalog } from '../theme/theme-catalog.js'; import { type ToolResult } from './mcp-protocol.js'; /** What `tools/list` announces for one tool. */ export interface McpToolDefinition { readonly name: string; readonly description: string; readonly inputSchema: Record; } /** * A runnable tool. `C` is the transport's per-call context; `R` lets the HTTP * transport run asynchronous tools while stdio stays synchronous. */ export interface McpTool = ToolResult> extends McpToolDefinition { run: (args: Record, context: C) => R; } export declare function requireString(args: Record, key: string): string; /** The optional `theme` argument, normalized: an empty string means "not given". */ export declare function optionalTheme(args: Record): string | undefined; export declare const CATALOG_TOOL: McpTool; export declare const SEARCH_CATALOG_TOOL: McpTool; export declare const DESCRIBE_TOOL: McpTool; export declare const RECIPES_TOOL: McpTool; export declare const RECIPE_TOOL: McpTool; export declare const VALIDATE_TOOL: McpTool; /** `render` as the local stdio server runs it: the HTML goes to a file. */ export declare const LOCAL_RENDER_DEFINITION: McpToolDefinition; /** * `render` as a remote server runs it. A remote server cannot write into the * caller's filesystem, so the artifact is stored behind a URL instead and the * reply is the same compact summary plus that URL. */ export declare const REMOTE_RENDER_DEFINITION: McpToolDefinition; export declare const THEMES_DEFINITION: McpToolDefinition; /** The compact render summary every transport returns instead of the HTML. */ export interface RenderSummary { bytes: number; hash: string; title: string; theme: string; features: CompileResult['features']; nodes: number; warnings: CompileResult['warnings']; } export declare function renderSummary(result: CompileResult): RenderSummary; /** The `themes` reply for a catalog, sorted by name. */ export declare function themesResult(themes: Pick): ToolResult; /** * `themes` for a server with no project or user presets on disk, such as a * remote one: the built-in presets, in the same reply shape as the local tool. */ export declare const BUILTIN_THEMES_TOOL: McpTool; //# sourceMappingURL=mcp-tool-definitions.d.ts.map