import { StitchConfig, StitchToolClientSpec, VirtualToolDefinition } from "./spec/client.js"; /** * Authenticated tool pipe for the Stitch MCP Server. * * Designed for agents and orchestration scripts that forward JSON payloads * to MCP tools. Handles auth injection via the transport layer (not global fetch). * * Usage: * const client = new StitchToolClient(); // reads STITCH_API_KEY from env * const result = await client.callTool("generate_screen_from_text", { ... }); */ export declare class StitchToolClient implements StitchToolClientSpec { name: "stitch-tool-client"; description: "Authenticated tool pipe for Stitch MCP Server"; private client; private transport; private config; private isConnected; private connectPromise; private localVirtualTools; constructor(inputConfig?: Partial & { localVirtualTools?: VirtualToolDefinition[]; }); /** * Build auth headers based on config (API key or OAuth). */ private buildAuthHeaders; private parseToolResponse; connect(): Promise; private doConnect; /** * Generic tool caller with type support and error parsing. */ callTool(name: string, args: Record): Promise; /** * Make a direct REST POST to the Stitch API. * * Used for endpoints not available as MCP tools (e.g. BatchCreateScreens). * Reuses the same auth headers as callTool — both API key and OAuth Bearer * token are supported by all current REST POST endpoints. * * Throws StitchError on HTTP errors. Common failure modes: * - 401 CREDENTIALS_MISSING → the API key was empty (source .env first) * - 403 PERMISSION_DENIED → the key doesn't own the target project * Neither means "API keys are unsupported." See upload-handler.ts for full context. */ httpPost(path: string, body: unknown): Promise; listTools(): Promise<{ tools: any[]; }>; close(): Promise; } //# sourceMappingURL=client.d.ts.map