/** * 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 { buildUpdate } from "../../intent/build-update.js"; import { type PrimeDeps } from "../../lib/prime-schema.js"; import { UPDATE_INPUT } from "../../schemas/input-schemas.js"; import { runTool } from "../../schemas/tool-adapter.js"; export interface SfGqlUpdateToolOptions { primeDeps?: PrimeDeps; } const inputSchema = UPDATE_INPUT.shape; export function registerSfGqlUpdateTool( server: McpServer, opts: SfGqlUpdateToolOptions = {}, ): void { server.registerTool( "sf_gql_update", { description: "Build a UIAPI update mutation against a Salesforce org. Declares a typed input variable ($input: UpdateInput!) and selects return fields on the updated record. Returns rendered GraphQL, declared variables, generated TypeScript types, and validation warnings.", inputSchema, }, async (args) => runTool(() => buildUpdate(args, opts.primeDeps)), ); }