import type { Services } from '../../services.js'; import type { McpTool } from '../../utils/index.js'; import type { Scaffold, ResolvedParameters, ResolveParametersOptions } from '@salesforce/b2c-tooling-sdk/scaffold'; /** Optional overrides for testing (scaffold not found, missing required). */ export interface ScaffoldCustomApiExecuteOverrides { getScaffold?: (id: string, opts: { projectRoot: string; }) => Promise; resolveScaffoldParameters?: (scaffold: Scaffold, opts: ResolveParametersOptions) => Promise; } /** * Input schema for scapi_custom_api_generate_scaffold tool. * Parameters match the custom-api scaffold: apiName, apiType, cartridgeName, etc. */ interface ScaffoldCustomApiInput { /** API name (kebab-case, e.g. my-products). Required. */ apiName: string; /** Cartridge name that will contain the API. Optional; defaults to first cartridge found in project. */ cartridgeName?: string; /** API type: admin (no siteId) or shopper (siteId, customer-facing). Default: shopper */ apiType?: 'admin' | 'shopper'; /** Short description of the API. Default: "A custom B2C Commerce API" */ apiDescription?: string; /** Project root for cartridge discovery and output. Default: MCP project directory */ projectRoot?: string; /** Output directory override. Default: scaffold default or project root */ outputDir?: string; } /** * Output schema for scapi_custom_api_generate_scaffold tool. */ interface ScaffoldCustomApiOutput { scaffold: string; outputDir: string; dryRun: boolean; files: Array<{ path: string; action: string; skipReason?: string; }>; postInstructions?: string; error?: string; } /** * Core execute logic for the custom API scaffold tool. * Exported for tests so we can inject getScaffold / resolveScaffoldParameters and cover error branches. */ export declare function executeScaffoldCustomApi(args: ScaffoldCustomApiInput, services: Services, overrides?: ScaffoldCustomApiExecuteOverrides): Promise; /** * Creates the scapi_custom_api_generate_scaffold tool. * * Uses @salesforce/b2c-tooling-sdk scaffold: registry, resolveScaffoldParameters, * resolveOutputDirectory, generateFromScaffold. cartridgeName must be a cartridge * discovered under projectRoot (e.g. from .project or cartridges/). * * @param loadServices - Function that returns Services (used by adapter on each call). * @param executeOverrides - Optional overrides for testing (getScaffold, resolveScaffoldParameters). */ export declare function createScaffoldCustomApiTool(loadServices: () => Promise | Services, executeOverrides?: ScaffoldCustomApiExecuteOverrides): McpTool; export {};