import type { ApiFunctionsContext, ApiFunctionsContextMethods, McpToolDefinition, McpToolFileSystem, McpToolJsonValue, PageStaticData } from '@redocly/config'; import type { AuthInfo, CallToolResult, RequestId, RequestMeta, StandardSchemaWithJSON, ToolCallback } from '@modelcontextprotocol/server'; import type { OpenAPIPath, OpenAPIServer, OpenAPIOperation } from '@redocly/api-docs'; import type { McpErrorCodes, McpServerType } from './constants'; import type { McpToolSchema } from '../../types'; import type { Skill } from '../../types/plugins/skills.js'; import type { UpstreamSecrets } from './gateway-mcp/secret-store.js'; type ObjectValues = T[keyof T]; export type McpServerType = ObjectValues; export type McpErrorCodeTypes = ObjectValues; export type ApiDescriptionInfo = { name: string; relativePath: string; description?: string; version?: string; servers?: OpenAPIServer[]; fetchEligible?: boolean; }; export type GraphqlDescriptionInfo = { name: string; relativePath: string; description?: string; }; export type McpDocsStaticDataPropsConfig = { mcpDocsServerName: string; apiDescriptionsMap: Record; graphqlDescriptions: GraphqlDescriptionInfo[]; mcpMode: McpMode; elicitationEnabled: boolean; gatewayFetchBudgetPerExec: number; searchIgnoredRoutes?: string[]; isPublicEndpoint?: boolean; }; export type McpDocsStaticData = PageStaticData & { props: { config: McpDocsStaticDataPropsConfig; serverOutDir?: string; tools?: McpToolSchema[]; skills?: Skill[]; skillsBaseUrl?: string; }; }; export type SkillMcpResource = { slug: string; name: string; description: string; content: string; uri: string; }; export type McpPath = { 'x-mcp'?: XMcpConfig; } & OpenAPIPath; export type XMcpConfig = { docs?: { hide?: boolean; }; gateway?: { hide?: boolean; }; }; export type XMcpSection = keyof XMcpConfig; export type McpEndpoint = OpenAPIOperation & { 'x-mcp'?: XMcpConfig; }; export type McpMode = 'tools' | 'code'; export type McpUserInfo = { email?: string; name?: string; sub?: string; aud?: string | string[]; client_id?: string; scope?: string; iat?: number; exp?: number; [key: string]: unknown; }; export type SemanticSearchResult = { title: string; url: string; content: string; }; export type McpErrorClass = 'tool_error' | 'sandbox_error' | 'client_error' | 'server_error'; export type McpToolWorkerResponse = CallToolResult & { errorClass?: McpErrorClass; }; export type ToolArgs = Record; export type McpToolCallback = ToolCallback>; export type McpToolExtra = { sessionId?: string; authInfo?: AuthInfo; requestId: RequestId; _meta?: RequestMeta; }; export type McpToolContext = Omit & { apiDescriptionsMap: Record; graphqlDescriptions: GraphqlDescriptionInfo[]; products?: string[]; accessToken?: string; metadata?: Record; upstreamAuthorization?: string; mcpMode?: McpMode; elicitationEnabled?: boolean; gatewayFetchBudgetPerExec?: number; clientIp?: string; client?: string; clientVersion?: string; upstreamSecrets?: UpstreamSecrets; searchIgnoredRoutes?: string[]; internalBaseUrl?: string; sandboxToolSchemas?: Record>; fs?: McpToolFileSystem; }; export type McpToolHandler = (args: TArgs, context: McpToolContext, extra: McpToolExtra) => Promise; export type McpToolIsAvailable = (context: McpToolContext) => boolean | Promise; export type McpToolHandlerExtended = { execute: McpToolHandler; isAvailable?: McpToolIsAvailable; }; export type McpToolExecutionParams = { toolName: string; args: ToolArgs; context: McpToolContext; extra: McpToolExtra; }; export type CustomMcpToolsState = { registeredToolNames: string[]; }; export type ToolDefinitionValidationResult = { ok: true; schema: McpToolSchema; } | { ok: false; errors: string[]; }; export type ToolFileDefaultExport = Partial | null | undefined; export type McpToolModuleGetter = () => Promise<{ default: McpToolModuleExport; }>; export type McpToolMapExport = Record; export type McpToolFileExport = McpToolHandlerExtended & { description: string; }; export type McpToolModuleExport = McpToolMapExport | McpToolFileExport; export {}; //# sourceMappingURL=types.d.ts.map