/** * Service definitions for gws MCP server. * * Each service maps to a gws CLI service and defines the subset of * resource.method combinations exposed as MCP tools. This curated approach * avoids the context bloat problem (200-400 tools) that caused the original * gws MCP implementation to be removed. */ export interface ToolDef { /** MCP tool name, e.g. "drive_files_list" */ name: string; /** Human-readable description */ description: string; /** gws CLI args, e.g. ["drive", "files", "list"] */ command: string[]; /** Parameters passed via --params (query/path params) */ params: ParamDef[]; /** Parameters passed via --json (request body) */ bodyParams?: ParamDef[]; /** Whether this tool accepts a file upload via --upload */ supportsUpload?: boolean; /** Default params injected into every call (can be overridden by caller) */ defaultParams?: Record; /** * Read-only tool: no side effects on the user's data. Maps to MCP * annotation `readOnlyHint: true`. Mutually exclusive with `destructive`. */ readOnly?: boolean; /** * Destructive write: irreversibly removes or overwrites user data (deletes). * Maps to MCP annotations `{ readOnlyHint: false, destructiveHint: true }`. * Additive/reversible writes leave this unset and emit an explicit * `{ readOnlyHint: false, destructiveHint: false }`. */ destructive?: boolean; /** * Repeating the call with the same arguments leaves the account in the same * state as calling it once. Maps to MCP `idempotentHint`. * * Patches and deletes qualify; a delete's second call errors but adds no * further effect. Creates and appends do not — each call produces another * entity. Only meaningful on a write, so reads leave it unset. */ idempotent?: boolean; } /** MCP tool annotations derived from a ToolDef's declarative flags. */ export interface ToolAnnotationHints { readOnlyHint: boolean; destructiveHint?: boolean; idempotentHint?: boolean; openWorldHint: boolean; } /** * Map a ToolDef's declarative flags into MCP `annotations`. * * Every tool gets an explicit `readOnlyHint` (true for reads, false for any * write) so clients always know the side-effect class, and every write gets an * explicit `destructiveHint`. * * The explicit `destructiveHint: false` matters. Per the MCP schema the hint * defaults to **true**, so leaving it off an additive write does not mean * "non-destructive" — it means the opposite, and the client renders a * delete-grade consent prompt for a tool that only creates a draft. Only omit * it on a `readOnlyHint: true` tool, where the spec says it is ignored. * * `openWorldHint` is true on every tool: they all reach Google Workspace, * whose state changes independently of this server. That matches the schema * default, so stating it changes no client behaviour — it is documentation, * and it stops the hint being read as "unset because nobody considered it". * * `idempotentHint` is the one that carries weight. It defaults to **false**, * so unlike `destructiveHint` an omission is the safe direction: a client that * assumes a retry is unsafe merely asks again. It is emitted only on writes, * matching how `destructiveHint` is omitted on reads where the spec ignores it. */ export declare function buildAnnotations(tool: ToolDef): ToolAnnotationHints; export interface ParamDef { name: string; description: string; type: "string" | "number" | "boolean"; required: boolean; /** Closed set of accepted values (string params only). Enforced at the tool * boundary via z.enum, so an out-of-set value never reaches the wire. */ enum?: string[]; /** Body params only: send the value as the literal string it is. Without * this, buildArgs JSON-parses any string that decodes to an object or array * (how `requests`/`attendees` reach the API as arrays). Set it for fields * the API itself types as a string holding JSON, e.g. a comment `anchor`. */ literalString?: boolean; } export declare const SERVICE_TOOLS: Record; export declare const ALL_SERVICES: readonly string[]; export declare const DEFAULT_SERVICES: readonly string[]; export declare function getToolsForServices(services: readonly string[]): ToolDef[];