/** * 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 { buildDiscover, type DiscoverDeps } from "../../intent/build-discover.js"; import { DISCOVER_INPUT } from "../../schemas/input-schemas.js"; import { runTool } from "../../schemas/tool-adapter.js"; export type SfGqlDiscoverToolOptions = DiscoverDeps; const inputSchema = DISCOVER_INPUT.shape; export function registerSfGqlDiscoverTool( server: McpServer, opts: SfGqlDiscoverToolOptions = {}, ): void { server.registerTool( "sf_gql_discover", { description: "Discover Salesforce UIAPI schema metadata: list queryable SObjects, describe an object's fields/picklists/child relationships, or describe a single field. Returns mode-specific metadata (not the standard ToolOutput envelope).", inputSchema, }, async (args) => runTool(() => buildDiscover(args, opts)), ); }