import * as _anthropic_ai_claude_agent_sdk from '@anthropic-ai/claude-agent-sdk'; import { SdkMcpToolDefinition, McpSdkServerConfigWithInstance, CanUseTool } from '@anthropic-ai/claude-agent-sdk'; import { Files } from '../index.js'; import { A as ApprovalConfig, F as FileToolName } from '../approval-C65iPvEt.js'; export { a as FileReadToolName, b as FileWriteToolName } from '../approval-C65iPvEt.js'; import * as zod from 'zod'; /** * MCP tool annotations as accepted by `tool()` and exposed on * `SdkMcpToolDefinition`. Re-derived from the SDK rather than imported from * `@modelcontextprotocol/sdk` directly to avoid taking on a second peer * dependency. */ type ToolAnnotations = NonNullable; /** * Per-tool overrides for `createClaudeFileTools`. `name`, `inputSchema`, and * `handler` are intentionally not overridable — the contract that drives tool * behavior should not be patched at this layer. */ interface ClaudeToolOverrides { description?: string; annotations?: ToolAnnotations; } interface ClaudeWriteToolOptions { annotations?: ToolAnnotations; } declare const claudeListFiles: (files: Files) => _anthropic_ai_claude_agent_sdk.SdkMcpToolDefinition<{ cursor: zod.ZodOptional; limit: zod.ZodOptional; prefix: zod.ZodOptional; }>; declare const claudeGetFileMetadata: (files: Files) => _anthropic_ai_claude_agent_sdk.SdkMcpToolDefinition<{ key: zod.ZodString; }>; declare const claudeDownloadFile: (files: Files) => _anthropic_ai_claude_agent_sdk.SdkMcpToolDefinition<{ binary: zod.ZodOptional; key: zod.ZodString; maxBytes: zod.ZodOptional; }>; declare const claudeGetFileUrl: (files: Files) => _anthropic_ai_claude_agent_sdk.SdkMcpToolDefinition<{ expiresIn: zod.ZodOptional; key: zod.ZodString; responseContentDisposition: zod.ZodOptional; }>; declare const claudeUploadFile: (files: Files, { annotations }?: ClaudeWriteToolOptions) => _anthropic_ai_claude_agent_sdk.SdkMcpToolDefinition<{ cacheControl: zod.ZodOptional; content: zod.ZodString; contentType: zod.ZodOptional; encoding: zod.ZodOptional>; key: zod.ZodString; metadata: zod.ZodOptional>; }>; declare const claudeDeleteFile: (files: Files, { annotations }?: ClaudeWriteToolOptions) => _anthropic_ai_claude_agent_sdk.SdkMcpToolDefinition<{ key: zod.ZodString; }>; declare const claudeCopyFile: (files: Files, { annotations }?: ClaudeWriteToolOptions) => _anthropic_ai_claude_agent_sdk.SdkMcpToolDefinition<{ from: zod.ZodString; to: zod.ZodString; }>; declare const claudeSignUploadUrl: (files: Files, { annotations }?: ClaudeWriteToolOptions) => _anthropic_ai_claude_agent_sdk.SdkMcpToolDefinition<{ contentType: zod.ZodOptional; expiresIn: zod.ZodNumber; key: zod.ZodString; maxSize: zod.ZodOptional; minSize: zod.ZodOptional; }>; interface ClaudeFileToolsOptions { /** * The configured `Files` instance the tools will operate against. */ files: Files; /** * When `true`, write tools (`uploadFile`, `deleteFile`, `copyFile`, * `signUploadUrl`) are omitted from the MCP server. The model cannot * mutate the bucket regardless of approval configuration. */ readOnly?: boolean; /** * Approval gating reflected by {@link ClaudeFileTools.needsApproval} and * the bundled {@link ClaudeFileTools.canUseTool}. Defaults to `true` * (every write requires approval). Pass `false` to disable, or an object * keyed by write-tool name for fine-grained control. */ requireApproval?: ApprovalConfig; /** * Per-tool overrides for `description` / `annotations` without touching * the underlying handler or input schema. */ overrides?: Partial>; /** * Name of the in-process MCP server that wraps these tools. Affects the * `mcp____` strings the agent uses to address * each tool. Defaults to `"files"`. */ serverName?: string; /** * MCP server `version` metadata. Defaults to `"1.0.0"`. */ serverVersion?: string; } interface ClaudeFileTools { /** * Pass into `query({ options: { mcpServers: tools.mcpServers } })`. */ mcpServers: Record; /** * Pass into `query({ options: { allowedTools: tools.allowedTools } })`. * Each entry is of the form `mcp____`. */ allowedTools: string[]; /** * Ready-made `canUseTool` callback. Allows reads unconditionally, allows * writes whose `needsApproval` resolves to `false`, denies the rest with * a `"requires approval"` message. Pass directly into `query()`, or * compose your own using {@link ClaudeFileTools.needsApproval}. */ canUseTool: CanUseTool; /** * Whether the named tool is approval-gated under the configured * `requireApproval`. Accepts both bare names (`"uploadFile"`) and the * MCP-prefixed form (`"mcp__files__uploadFile"`). Read tools and unknown * names return `false`. */ needsApproval(toolName: string): boolean; /** * The raw SDK MCP server instance — same value as * `mcpServers[serverName]`. Exposed for callers that want to compose it * into a larger `mcpServers` map. */ server: McpSdkServerConfigWithInstance; /** * The MCP server name used in the `mcp____*` prefix. */ serverName: string; } /** * Create files-sdk tools shaped for the Claude Agent SDK * (`@anthropic-ai/claude-agent-sdk`). * * The Claude Agent SDK consumes tools by way of an in-process MCP server + * an `allowedTools` allow-list + a `canUseTool` approval callback. The * returned bundle gives you all three, plus the raw server instance and a * `needsApproval()` helper if you want to wire your own `canUseTool`. * * @example * ```ts * import { query } from "@anthropic-ai/claude-agent-sdk"; * import { Files } from "files-sdk"; * import { s3 } from "files-sdk/s3"; * import { createClaudeFileTools } from "files-sdk/claude"; * * const files = new Files({ adapter: s3({ bucket: "uploads" }) }); * const tools = createClaudeFileTools({ files }); * * for await (const message of query({ * prompt: "List my files.", * options: { * mcpServers: tools.mcpServers, * allowedTools: tools.allowedTools, * canUseTool: tools.canUseTool, * }, * })) { * // handle messages * } * ``` * * @example Read-only agent * ```ts * createClaudeFileTools({ files, readOnly: true }) * ``` * * @example Granular approval * ```ts * createClaudeFileTools({ * files, * requireApproval: { * deleteFile: true, * uploadFile: false, * copyFile: false, * signUploadUrl: true, * }, * }) * ``` */ declare const createClaudeFileTools: ({ files, readOnly, requireApproval, overrides, serverName, serverVersion, }: ClaudeFileToolsOptions) => ClaudeFileTools; export { ApprovalConfig, type ClaudeFileTools, type ClaudeFileToolsOptions, type ClaudeToolOverrides, type ClaudeWriteToolOptions, FileToolName, type ToolAnnotations, claudeCopyFile, claudeDeleteFile, claudeDownloadFile, claudeGetFileMetadata, claudeGetFileUrl, claudeListFiles, claudeSignUploadUrl, claudeUploadFile, createClaudeFileTools };