Skip to main content
Glama
ahmedselimmansor-ctrl

IBM Cloud MCP Server

vpc_delete_subnet

Delete a subnet by providing its subnet ID. Optionally specify the region to target the correct VPC.

Instructions

Delete a subnet

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
subnet_idYes
regionNo

Implementation Reference

  • The handler function for the 'vpc_delete_subnet' tool. It accepts 'subnet_id' (required) and optional 'region', validates write access via assertWriteAllowed(), then sends a DELETE request to the VPC API endpoint '/subnets/{subnet_id}'. Returns {message: 'Subnet deleted'} on success.
    server.tool("vpc_delete_subnet", "Delete a subnet", {
      subnet_id: z.string(), region: z.string().optional(),
    }, async (p) => safeTool(async () => { w(); await client.delete(vpcUrl(p.region||r, `/subnets/${p.subnet_id}`)); return {message:"Subnet deleted"}; }));
  • Input schema for 'vpc_delete_subnet' defined inline: 'subnet_id' (z.string(), required) and 'region' (z.string(), optional). Zod is imported at line 2.
    server.tool("vpc_delete_subnet", "Delete a subnet", {
      subnet_id: z.string(), region: z.string().optional(),
    }, async (p) => safeTool(async () => { w(); await client.delete(vpcUrl(p.region||r, `/subnets/${p.subnet_id}`)); return {message:"Subnet deleted"}; }));
  • The 'registerVPCTools' function (lines 7-9) is the registration function that calls server.tool(...) for all VPC tools, including 'vpc_delete_subnet' on line 44. It is invoked from src/server.ts line 53.
    export function registerVPCTools(server: McpServer, client: IBMCloudAPIClient, config: ServerConfig) {
      const r = config.region;
      const w = () => assertWriteAllowed(config.allowWrite);
  • assertWriteAllowed() helper used by the handler to throw if write operations are disabled in config.
    export function assertWriteAllowed(allowWrite: boolean): void {
      if (!allowWrite) {
        throw new WriteNotAllowedError();
      }
    }
  • vpcUrl() helper used by the handler to build the full API URL with version and generation parameters.
    export function vpcUrl(region: string, path: string, version: string = "2024-11-19"): string {
      const base = `https://${region}.iaas.cloud.ibm.com/v1${path}`;
      const sep = base.includes("?") ? "&" : "?";
      return `${base}${sep}version=${version}&generation=2`;
    }
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description must disclose behavioral traits. It only states 'Delete', which implies a destructive operation, but fails to mention whether it is irreversible, what happens to dependent resources (e.g., instances, interfaces), or any security requirements.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is very concise at one sentence, but conciseness should not come at the cost of completeness. It is minimal but not overly verbose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool is destructive, has no output schema, and no parameter descriptions, the description is insufficient. It lacks details on prerequisites, effects, and return values, making it hard for an agent to use safely.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description should clarify parameters. It does not mention subnet_id (required) or region (optional) at all, leaving the agent to infer meaning solely from parameter names.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Delete a subnet' clearly states the action (delete) and resource (subnet), making the purpose immediately understandable. However, it does not differentiate from other delete tools in the VPC family, but the resource specificity is sufficient.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives like vpc_create_subnet or vpc_list_subnets. There are no prerequisites mentioned, such as the subnet needing to be empty or unattached.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ahmedselimmansor-ctrl/IBM_cloud_MCP_SERVER'

If you have feedback or need assistance with the MCP directory API, please join our Discord server