/** * MCP tool generator from profile definitions * * Why: Translates profile config into MCP SDK tool definitions. Handles both * simple (single operation) and composite (multi-step) tools. */ import type { Tool } from '@modelcontextprotocol/sdk/types.js'; import type { ToolDefinition } from '../types/profile.js'; import type { OpenAPIParser } from '../openapi/openapi-parser.js'; export declare class ToolGenerator { private parser; private regexValidator; private regexValidationCache; private compiledRegexCache; constructor(parser: OpenAPIParser); /** * Generate MCP tool from profile definition */ generateTool(toolDef: ToolDefinition): Tool; /** * Generate JSON Schema for tool parameters * * Why JSON Schema: MCP SDK expects JSON Schema for parameter validation. * LLM uses schema to understand what parameters are needed. */ private generateInputSchema; /** * Convert parameter definition to JSON Schema */ private parameterToJsonSchema; private parameterTypeToSchema; /** * Validate tool arguments against parameter definitions * * Why manual validation: Checks conditional requirements (required_for) * which JSON Schema can't express directly. */ validateArguments(toolDef: ToolDefinition, args: Record): void; /** * Get operation definition (string or ProxyDownloadOperation) for action * * Why: Tools can have string operationIds OR proxy_download configs. * This returns the raw definition before extracting operationId. */ getOperationDefinition(toolDef: ToolDefinition, args: Record): import("../types/profile.js").OperationDefinition | undefined; /** * Map tool action to OpenAPI operation ID * * Why: Single tool with 'action' parameter maps to multiple operations. * Example: manage_badges + action=create => postApiV4ProjectsIdBadges * * Note: Returns undefined for ProxyDownloadOperation (not a direct operationId) */ mapActionToOperation(toolDef: ToolDefinition, args: Record): string | undefined; /** * Check if operation requires multipart/form-data * * Why: Some operations (file uploads) need FormData instead of JSON body. * Detected from OpenAPI requestBody.content['multipart/form-data']. */ isMultipartOperation(operationId: string): boolean; /** * Build FormData body for file upload * * @param args Tool arguments including base64Content or filePath * @param fileFieldName Field name in FormData (default: 'files[0]') */ buildFormDataBody(args: Record, fileFieldName?: string): FormData; } //# sourceMappingURL=tool-generator.d.ts.map