UNPKG

n8n-nodes-explorium

Version:
30 lines (29 loc) 1.41 kB
import { Client } from '@modelcontextprotocol/sdk/client/index.js'; import type { JSONSchema7 } from 'json-schema'; import { DynamicStructuredTool, type DynamicStructuredToolInput } from '@langchain/core/tools'; import { type IDataObject, type Result } from 'n8n-workflow'; import { z } from 'zod'; declare type McpTool = { name: string; description?: string; inputSchema: JSONSchema7; }; export declare function getAllTools(client: Client, cursor?: string): Promise<McpTool[]>; export declare const getErrorDescriptionFromToolCall: (result: unknown) => string | undefined; export declare const createCallTool: (name: string, client: Client, onError: (error: string | undefined) => void) => (args: IDataObject) => Promise<void | {} | null>; export declare function mcpToolToDynamicTool(tool: McpTool, onCallTool: DynamicStructuredToolInput['func']): DynamicStructuredTool<z.ZodTypeAny, any, any, any>; declare type ConnectMcpClientError = { type: 'invalid_url'; error: Error; } | { type: 'connection'; error: Error; }; export declare function connectMcpClient({ headers, sseEndpoint, name, version, }: { sseEndpoint: string; headers?: Record<string, string>; name: string; version: number; }): Promise<Result<Client, ConnectMcpClientError>>; export declare function convertJsonSchemaToZod<T extends z.ZodTypeAny = z.ZodTypeAny>(schema: JSONSchema7): T; export {};