/** * Copyright (c) 2026, Salesforce, Inc., * All rights reserved. * For full license text, see the LICENSE.txt file */ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { buildRaw } from "../../intent/build-raw.js"; import { type PrimeDeps } from "../../lib/prime-schema.js"; import { RAW_INPUT } from "../../schemas/input-schemas.js"; import { runTool } from "../../schemas/tool-adapter.js"; export interface SfGqlRawToolOptions { primeDeps?: PrimeDeps; } const inputSchema = RAW_INPUT.shape; export function registerSfGqlRawTool(server: McpServer, opts: SfGqlRawToolOptions = {}): void { server.registerTool( "sf_gql_raw", { description: "Low-level escape hatch: build an arbitrary UIAPI query, mutation, or aggregate from CLI-style commands (select/set/var) when the typed tools don't model the case (cross-union selections, custom mutations). Returns rendered GraphQL, declared variables, generated TypeScript types, and validation warnings. Fails fast on a bad command.", inputSchema, }, async (args) => runTool(() => buildRaw(args, opts.primeDeps)), ); }