import type { Tool, ToolAnnotations } from "@modelcontextprotocol/sdk/types.js"; import type { MailProvider, ProviderCapabilities } from "../providers/interface.js"; import type { AccountConfig, AccountManager } from "../accounts.js"; import { ResponseFence } from "../security/sanitize.js"; export interface ToolContext { accountManager: AccountManager; getProvider: (alias: string) => MailProvider | Promise; clearProviderCache?: (alias: string) => void; /** Per-response fence; the registry creates one for every call. */ fence: ResponseFence; } export type ToolContextInput = Omit & { fence?: ResponseFence; }; export type ToolResult = { content: Array<{ type: "text"; text: string; }>; isError?: boolean; }; export interface ToolHandler { (args: Record, ctx: ToolContext): Promise; } export declare const TOOL_ANNOTATIONS: Record; export declare function registerTool(definition: Tool, handler: ToolHandler, requiredCapability?: keyof ProviderCapabilities): void; export declare const TOOL_GROUPS: Record; export type ToolProfile = "full" | "draft" | "read"; export declare const DRAFT_PROFILE_EXCLUDED: Set; export declare function activeProfile(): ToolProfile; export declare function getAllToolDefinitions(): Tool[]; export declare function sanitizeErrorMessage(message: string, redactTokens: (s: string) => string): string; export declare function lookupAccount(ctx: ToolContext, alias: string): AccountConfig | undefined; export declare function readOnlyRefusal(alias: string): ToolResult; export declare function handleToolCall(name: string, args: Record, input: ToolContextInput): Promise;