update_gateway
Update a payment gateway's display name or credentials by providing the gateway ID and optional display name or settings object.
Instructions
Update a company gateway. PUT /gateways/{gatewayId}. Optional: displayName, setting (credentials key-value object).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| gatewayId | Yes | Gateway ID (required) | |
| displayName | No | Display name | |
| setting | No | Credentials object (key-value). Keys depend on gateway type. |
Implementation Reference
- Handler function that parses args, extracts gatewayId/displayName/setting, and calls gatewayService.updateGateway.
async function handler(client: Client, args: Record<string, unknown> | undefined) { const parsed = schema.safeParse(args); if (!parsed.success) { return errorResult(parsed.error.errors.map((e) => e.message).join("; ")); } const { gatewayId, displayName, setting } = parsed.data; const body = { displayName, setting }; return handleToolCall(() => gatewayService.updateGateway(client, gatewayId, body)); } - Zod schema for update_gateway input validation: gatewayId (required), displayName (optional), setting (optional record).
const settingSchema = z.record(z.union([z.string(), z.number(), z.boolean()])).optional(); const schema = z.object({ gatewayId: z.string().min(1, "gatewayId is required"), displayName: z.string().optional(), setting: settingSchema, }); - Tool definition/input schema for update_gateway with name, description, and JSON Schema input properties.
const definition = { name: "update_gateway", description: "Update a company gateway. PUT /gateways/{gatewayId}. Optional: displayName, setting (credentials key-value object).", inputSchema: { type: "object" as const, properties: { gatewayId: { type: "string", description: "Gateway ID (required)" }, displayName: { type: "string", description: "Display name" }, setting: { type: "object", description: "Credentials object (key-value). Keys depend on gateway type.", }, }, required: ["gatewayId"], }, }; - src/tools/gateways/index.ts:14-29 (registration)Import and export of updateGatewayTool; included in registerGatewayTools array at line 25.
import { updateGatewayTool } from "./updateGateway.js"; /** All gateway tools. */ export function registerGatewayTools(): Tool[] { return [ listGlobalGatewaysTool, listGatewaysTool, getGatewayTool, getClientTokenTool, createSetupIntentTool, createGatewayTool, updateGatewayTool, deleteGatewayTool, testGatewayTool, ]; } - updateGateway service function that sends PUT /gateways/{gatewayId} with filtered body payload.
/** PUT /gateways/{gatewayId} */ export async function updateGateway( client: Client, gatewayId: string, body: UpdateGatewayBody ): Promise<unknown> { const payload = Object.fromEntries( Object.entries(body).filter(([, v]) => v !== undefined) ) as UpdateGatewayBody; return client.put<unknown>(`/gateways/${gatewayId}`, Object.keys(payload).length ? payload : {}); }