UNPKG

mcp-server-kubernetes

Version:

MCP server for interacting with Kubernetes clusters via kubectl

45 lines (44 loc) 1.54 kB
/** * Tool call handler function type */ type ToolCallHandler = (request: { params: { name: string; _meta?: any; arguments?: Record<string, any>; }; method: string; }) => Promise<any>; /** * Wrap a tool call handler with OpenTelemetry tracing * Creates a span for each tool invocation with detailed attributes * * @param handler - The original tool call handler function * @returns Wrapped handler with tracing instrumentation */ export declare function withTelemetry(handler: ToolCallHandler): ToolCallHandler; /** * Create a manual span for non-tool operations * Useful for tracing other server operations outside of tool calls * * @param name - Span name * @param fn - Function to execute within the span * @returns Result of the function */ export declare function withSpan<T>(name: string, attributes: Record<string, string | number | boolean>, fn: () => Promise<T>): Promise<T>; /** * Add custom attributes to the current active span * Useful for adding context during tool execution * * @param attributes - Key-value pairs to add to the span */ export declare function addSpanAttributes(attributes: Record<string, string | number | boolean>): void; /** * Record an event on the current active span * Useful for tracking significant moments during tool execution * * @param name - Event name * @param attributes - Optional event attributes */ export declare function recordSpanEvent(name: string, attributes?: Record<string, string | number | boolean>): void; export {};