import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { z } from "zod"; import type { JsonApiResponse, JsonApiResource } from "../types.js"; interface CrudToolOptions { entityName: string; entityNamePlural: string; apiPath: string; prefix: string; } interface SearchToolOverrides { schema?: z.ZodType; title?: string; description?: string; /** * Bespoke one-line summary for rows the generic summary renders poorly * (`/times-reports` rows have no name / title — `timesheetSummary`). Used * for the text output and for `structuredContent.items[].summary` alike. */ summaryFn?: (entity: JsonApiResource) => string; } export declare const SearchOutputSchema: z.ZodObject<{ total: z.ZodOptional; count: z.ZodNumber; items: z.ZodArray; type: z.ZodOptional; summary: z.ZodOptional; attributes: z.ZodOptional>; }, z.core.$strip>>; }, z.core.$strip>; export declare const MutationOutputSchema: z.ZodObject<{ id: z.ZodOptional; type: z.ZodOptional; }, z.core.$strip>; export declare const DeleteOutputSchema: z.ZodObject<{ id: z.ZodString; deleted: z.ZodBoolean; reason: z.ZodOptional; }, z.core.$strip>; /** Build the compact structured payload for a search result page. Exported for unit testing. */ export declare function buildListStructured(response: JsonApiResponse, fields?: string[], summaryFn?: (entity: JsonApiResource) => string): z.infer; export declare function entityRef(response: JsonApiResponse): z.infer; export interface ConfirmChoiceOptions { /** Question shown to the end user. */ message: string; /** Title of the single-select field. */ title: string; /** Help text under the field. */ description: string; /** Label of the option that confirms the irreversible action. */ confirmTitle: string; /** `true` when the operator opted out of this confirmation through its env flag. */ disabled: boolean; } /** * Generic titled single-select confirmation (the mechanics documented on * `confirmDeletion`, which is its first caller). Issue #251 reuses it for the * rejection of a validation: "reject" is not destructive in the delete sense, * but it is a decision the workflow does not undo by itself, so it gets the * same safe-default prompt. The confirm value is always `"delete"` on the wire * so a client built against the delete schema keeps answering correctly. */ export declare function confirmChoice(server: McpServer, options: ConfirmChoiceOptions): Promise<{ confirmed: boolean; reason?: string; }>; export declare function confirmDeletion(server: McpServer, entityName: string, id: string): Promise<{ confirmed: boolean; reason?: string; }>; export declare function registerSearchTool(server: McpServer, opts: CrudToolOptions, overrides?: SearchToolOverrides): void; interface GetToolOverrides { /** * When false, registers a plain id-only get tool (no `tab` parameter). * Use for reference/admin domains that have no tab endpoints. Defaults to * true (tab-aware), as used by the major entities. */ withTab?: boolean; title?: string; description?: string; } export declare function registerGetTool(server: McpServer, opts: CrudToolOptions, overrides?: GetToolOverrides): void; interface CreateToolOverrides { title?: string; description?: string; } export declare function registerCreateTool(server: McpServer, opts: CrudToolOptions, schema: z.ZodType, buildBody: (params: Record) => unknown, overrides?: CreateToolOverrides): void; interface UpdateToolOverrides { /** HTTP verb for the update call. A few BoondManager endpoints expect PUT * (e.g. /expenses-reports) rather than the JSON:API-conventional PATCH. */ method?: "PATCH" | "PUT"; /** Sub-resource segment appended to `${apiPath}/${id}` for the update call * (e.g. "information" → PUT /opportunities/{id}/information). Some entities * only accept updates on their `/information` sub-resource and return 405 on * PATCH/PUT against the base resource (see issue #124). */ pathSuffix?: string; title?: string; /** Overrides the composed default (see `description-builders.ts`). */ description?: string; } export declare function registerUpdateTool(server: McpServer, opts: CrudToolOptions, schema: z.ZodType, buildBody: (params: Record) => unknown, overrides?: UpdateToolOverrides): void; interface DeleteToolOverrides { title?: string; description?: string; } export declare function registerDeleteTool(server: McpServer, opts: CrudToolOptions, overrides?: DeleteToolOverrides): void; /** * Builds a JSON:API `{ data: { type, attributes[, id][, relationships] } }` * payload. `undefined` attributes are dropped (so PATCH only touches the * fields the caller actually supplied). `relationships` maps a relation name * to a `{ id, type }` resource identifier and is wrapped in the JSON:API * `{ data: ... }` envelope; entries are skipped when their value is undefined. */ export declare function buildJsonApiBody(type: string, attributes: Record, id?: string, relationships?: Record): unknown; export {}; //# sourceMappingURL=crud-factory.d.ts.map