import { Server } from "@modelcontextprotocol/sdk/server/index.js"; import { type StorageClient } from "./storage/client.js"; import { type AccessContext } from "./governance/accessControl.js"; export declare const TOOL_DEFINITIONS: ({ name: string; description: string; inputSchema: object; annotations: { title: string; readOnlyHint: boolean; destructiveHint?: undefined; }; } | { name: string; description: string; inputSchema: object; annotations: { title: string; readOnlyHint: boolean; destructiveHint: boolean; }; })[]; export declare class ToolNotAvailableError extends Error { constructor(name: string); } export declare function isExpandedToolsEnabled(): boolean; export declare function isToolVisible(name: string): boolean; export declare function getVisibleTools(): typeof TOOL_DEFINITIONS; export interface ExecuteToolCallOptions { /** * When false, skip the automatic Phase 4 relevance-signal recording that * executeToolCall normally fires for read_page and search_pages. The REST v1 * read_page shim passes false so it can record the signal itself, only after * confirming the response is a real 200 and not a 304 poll (GH #755). */ recordRelevanceSignal?: boolean; } export declare function executeToolCall(drive: StorageClient, name: string, args: unknown, userId?: string, accessCtx?: AccessContext, opts?: ExecuteToolCallOptions): Promise; /** * `driveOverride` may be a fixed StorageClient (legacy behavior — resolved * once, reused for the server's lifetime) or a resolver function that is * invoked fresh on every single tool call. * * Long-lived callers (e.g. an MCP session kept open over many requests) MUST * pass a resolver, not a fixed client: baking in a snapshot means any access * change that happens mid-session — most importantly a project-share grant * revocation (BRA-368/BRA-377) — never takes effect until the session ends. * Passing a plain StorageClient is only safe for genuinely single-request or * single-process-lifetime contexts (e.g. the stdio CLI entrypoint). */ /** * Mutable per-request hook for observing a tool call's result as it completes * inside the MCP `CallToolRequestSchema` handler. A session's Server instance * is created once and reused across many requests (see createBrainsServer's * doc comment), but the caller wants to enrich a specific HTTP response's * request_events row — so it swaps `current` in immediately before dispatching * that one request and clears it afterward, rather than baking a fixed * callback in at session-creation time (GH #411: `tool` was already threaded * through per request; `query_ms`/`backend`/etc. need the same treatment). */ export interface ToolCallHook { current?: (name: string, result: unknown) => void; } export declare function createBrainsServer(driveOverride?: StorageClient | (() => Promise), userId?: string, userAccessLevel?: number, toolCallHook?: ToolCallHook): Server; //# sourceMappingURL=server.d.ts.map