UNPKG

@juspay/neurolink

Version:

Universal AI Development Platform with working MCP integration, multi-provider support, voice (TTS/STT/realtime), and professional CLI. 58+ external MCP servers discoverable, multimodal file processing, RAG pipelines. Build, test, and deploy AI applicatio

58 lines (57 loc) 2.17 kB
/** * MCP Tool Annotations System * * Enhanced tool annotations for MCP tools providing hints to AI models * about tool behavior, safety, and execution characteristics. * * Implements MCP 2024-11-05 specification tool annotations including: * - readOnlyHint: Tool only reads data * - destructiveHint: Tool performs destructive operations * - idempotentHint: Tool can be safely retried * - requiresConfirmation: Tool needs user confirmation * * @module mcp/toolAnnotations * @since 8.39.0 */ import type { MCPServerTool, MCPToolAnnotations } from "../types/index.js"; /** * Infer annotations from tool definition * Uses heuristics based on tool description and name */ export declare function inferAnnotations(tool: Pick<MCPServerTool, "name" | "description">): MCPToolAnnotations; /** * Merge multiple annotation objects with precedence * Later annotations override earlier ones */ export declare function mergeAnnotations(...annotationSets: (MCPToolAnnotations | undefined)[]): MCPToolAnnotations; /** * Validate tool annotations * Returns list of validation errors (empty if valid) */ export declare function validateAnnotations(annotations: MCPToolAnnotations): string[]; /** * Create a tool with default annotations inferred */ export declare function createAnnotatedTool(tool: Omit<MCPServerTool, "annotations"> & { annotations?: MCPToolAnnotations; }): MCPServerTool; /** * Check if a tool requires confirmation based on annotations */ export declare function requiresConfirmation(tool: MCPServerTool): boolean; /** * Check if a tool is safe for automatic retry */ export declare function isSafeToRetry(tool: MCPServerTool): boolean; /** * Get tool safety level based on annotations */ export declare function getToolSafetyLevel(tool: MCPServerTool): "safe" | "moderate" | "dangerous"; /** * Filter tools by annotation predicates */ export declare function filterToolsByAnnotations(tools: MCPServerTool[], predicate: (annotations: MCPToolAnnotations) => boolean): MCPServerTool[]; /** * Get human-readable summary of tool annotations */ export declare function getAnnotationSummary(annotations: MCPToolAnnotations): string;