import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import type { DomainName } from "../constants.js"; /** * Per-domain registration decorations, applied centrally in * `server.ts::registerAll` so none of the 38 domain files has to know about * them. Two jobs, both keyed on the domain the registrar belongs to (which the * caller knows for free — it is iterating `TOOL_REGISTRARS`): * * 1. enrich `*_search` input schemas with filter-correction messages * (`validation-wrapper.ts`); * 2. disclose the semantics of `fields` / `page` / `pageSize` on the tools * that declare them (`parameter-disclosure.ts`) — facts a JSON Schema * cannot carry, on ~32 tools spread over as many files; * 3. backfill the "when / rather than" guidance on the hand-rolled tools * (`usage-guidance.ts`), which the composed templates already carry; * 4. record `tool name → domain` so the icon layer can attach the right * domain icon without parsing tool names (`icons.ts`). * * Deliberately NOT merged into `withPolicy`: that wrapper has a fast path * returning the untouched server when no operation filter is active, and these * decorations must apply unconditionally. */ export interface RegistrationIndex { /** * Tool name → owning domain. Filled at registration time from * `TOOL_REGISTRARS`, so it is exact for multi-word domains * (`provider-invoices`) and for tools whose name doesn't start with their * domain (`boond_workflow_*` ← `workflows`). */ toolDomains: Map; } export declare function createRegistrationIndex(): RegistrationIndex; /** * Wrap a server so every handler registered through it — tool, prompt or * resource — runs inside a request context (issues #231, #236) and every tool * call leaves one log line. * * The handler is always the last argument of the registration call and * `extra` the last argument of the handler (`(args, extra)` for a tool with an * input schema, `(extra)` without, `(uri, variables, extra)` for a template). * From `extra` the wrapper takes: * * - `signal` — so `send()` can abort the BoondManager call on * `notifications/cancelled`; * - `_meta.traceparent` (SEP-414) — forwarded to BoondManager verbatim, and * its `trace-id` becomes the `corrId`; otherwise the id the HTTP transport * generated for the connection is kept, and on stdio a fresh one is made. * `_meta.baggage` is never read. * * `send()` reads the context back from the AsyncLocalStorage, so the ~180 * handlers and the client helpers keep their signatures. The tool log line — * `{ corrId, tool, durationMs, ok, chars }` — is the single place ~185 tools * are instrumented; a thrown handler is logged at `warn` and rethrown so the * SDK still turns it into an `isError` result. * * Applied once, on the innermost server, in `server.ts::registerAll` — before * the per-domain decorations and the access policy — so that nothing * registered anywhere escapes it. */ export declare function instrumentHandlers(server: McpServer): McpServer; /** * Wrap a server (or an already-wrapped Proxy) so every `registerTool` call made * by `domain`'s registrar is decorated. Methods other than `registerTool` pass * straight through, bound to the real target so the SDK's private fields keep * working (same technique as `withPolicy`). */ export declare function decorateRegistrations(server: McpServer, domain: DomainName, index?: RegistrationIndex): McpServer; //# sourceMappingURL=registration-decorators.d.ts.map