import { Tool } from '@modelcontextprotocol/server'; import { z } from 'zod'; import { CodeModeConfig } from '../utils/CodeModeConfig.js'; import type { DisabledToolInfo } from '../utils/ToolPolicy.js'; declare const runCodeInputSchema: z.ZodObject<{ code: z.ZodString; input: z.ZodOptional; }, z.core.$strip>; type RunCodeInput = z.infer; type ToolExecutor = (toolName: string, args: unknown) => Promise; /** * Exposes a single `run_code` tool for code-mode MCP servers. * Following Anthropic's code execution with MCP approach: * https://www.anthropic.com/engineering/code-execution-with-mcp */ export declare class RunCodeTool { private readonly manifestPath; private cachedManifest; private toolExecutor?; private readonly deniedToolNames; private disabledToolInfo; private readonly descriptionBuilder; private readonly config; constructor(config?: CodeModeConfig['sandbox'], manifestPath?: string); readonly tool: Tool; /** * Set the tool executor for running MCP tools from within sandboxed code. */ setToolExecutor(executor: ToolExecutor): void; /** Deny selected tools inside generated code and omit them from discovery/type metadata. */ setDeniedTools(toolNames: Iterable): void; /** Publish the effective policy without exposing denied tools through discovery. */ setDisabledToolDetails(details: DisabledToolInfo[]): void; private createToolDefinition; execute(rawParams: RunCodeInput): Promise>; /** * Unwrap common list response formats to make the API easier to use. * Normalizes various response formats to { items: [...] } to match Kubernetes API standard format. * Handles: * - Arrays returned directly -> { items: [...] } * - { pods: [...] }, { services: [...] }, etc. -> { items: [...] } * - { items: [...] } -> returned as-is */ private unwrapResult; private getToolSchemaSummaries; private buildDescription; /** * Generate prompt content with tool overview and additional examples. * Used by the code-mode prompt for progressive disclosure. */ getPromptContent(): string; /** * Build a list of tool metadata from the manifest. */ private buildToolMetadata; private createToolsNamespace; private findToolByName; private createConsoleCapture; private stringifyConsoleValue; private serializeError; private buildResponse; private pushBounded; private truncateOutput; private withWallClockTimeout; private invokeTool; generateGlobalDts(): string; /** * Manually set the manifest/tools for the tool. * Useful when running in code-mode where tools are loaded in memory. */ setTools(tools: Tool[]): void; private jsonSchemaToTs; private jsonSchemaTypeToTs; private extractParametersFromSchema; private schemaTypeToString; private loadManifestSync; private filterDeniedTools; } export {}; //# sourceMappingURL=RunCodeTool.d.ts.map