tg_create_gateway
Create a transit gateway to interconnect virtual networks in IBM Cloud, specifying name, region, and optional global routing.
Instructions
Create a transit gateway
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| location | Yes | Region (e.g. us-south) | |
| global_routing | No |
Implementation Reference
- src/tools/networking/index.ts:61-66 (handler)The tool handler for 'tg_create_gateway'. Registers an MCP tool that creates an IBM Cloud Transit Gateway by POSTing to the Transit Gateway API. Accepts 'name' (string), 'location' (string describing region), and optional 'global_routing' (boolean). Calls assertWriteAllowed via w(), then POSTs to ${tg}/transit_gateways with the provided parameters.
server.tool("tg_create_gateway", "Create a transit gateway", { name: z.string(), location: z.string().describe("Region (e.g. us-south)"), global_routing: z.boolean().optional(), }, async (p) => safeTool(async () => { w(); return client.post(`${tg}/transit_gateways`, {name:p.name,location:p.location,global:p.global_routing||false}, {version:"2024-03-01"}); })); - src/tools/networking/index.ts:61-66 (schema)The input schema for 'tg_create_gateway'. Defines Zod validation: 'name' as z.string(), 'location' as z.string() with description 'Region (e.g. us-south)', and optional 'global_routing' as z.boolean().
server.tool("tg_create_gateway", "Create a transit gateway", { name: z.string(), location: z.string().describe("Region (e.g. us-south)"), global_routing: z.boolean().optional(), }, async (p) => safeTool(async () => { w(); return client.post(`${tg}/transit_gateways`, {name:p.name,location:p.location,global:p.global_routing||false}, {version:"2024-03-01"}); })); - src/server.ts:71-71 (registration)Registration of the networking tools module (which includes tg_create_gateway) via registerNetworkingTools(server, client, config) in the createServer function.
registerNetworkingTools(server, client, config); - src/tools/networking/index.ts:7-8 (registration)Export of the registerNetworkingTools function that receives the McpServer instance and registers all networking tools including tg_create_gateway.
export function registerNetworkingTools(server: McpServer, client: IBMCloudAPIClient, config: ServerConfig) { const w = () => assertWriteAllowed(config.allowWrite); - src/config.ts:58-58 (helper)Definition of TRANSIT_GATEWAY endpoint constant used in the tg_create_gateway handler: 'https://transit.cloud.ibm.com/v1'.
TRANSIT_GATEWAY: "https://transit.cloud.ibm.com/v1",