Skip to main content
Glama
ahmedselimmansor-ctrl

IBM Cloud MCP Server

vpc_list_subnets

List all subnets in an IBM Cloud VPC region. Filter by VPC ID and limit results for efficient network management.

Instructions

List all subnets

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo
vpc_idNo
regionNo

Implementation Reference

  • Registration of the 'vpc_list_subnets' MCP tool via server.tool(). Defines the tool name, description, schema (limit, vpc_id, region as optional params), and handler.
    server.tool("vpc_list_subnets", "List all subnets", {
      limit: z.number().optional(), vpc_id: z.string().optional(), region: z.string().optional(),
    }, async (p) => safeTool(() => client.get(vpcUrl(p.region||r, "/subnets"), {limit:p.limit,"vpc.id":p.vpc_id})));
  • Handler implementation for vpc_list_subnets. Calls client.get() with the VPC API URL for /subnets, passing limit and vpc.id query params, wrapped in safeTool() for error handling.
    server.tool("vpc_list_subnets", "List all subnets", {
      limit: z.number().optional(), vpc_id: z.string().optional(), region: z.string().optional(),
    }, async (p) => safeTool(() => client.get(vpcUrl(p.region||r, "/subnets"), {limit:p.limit,"vpc.id":p.vpc_id})));
  • Input schema for vpc_list_subnets: limit (number, optional), vpc_id (string, optional), region (string, optional) — all defined using Zod.
    limit: z.number().optional(), vpc_id: z.string().optional(), region: z.string().optional(),
  • Helper function vpcUrl() builds the VPC API URL with required version and generation query params.
    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`;
    }
  • Helper function safeTool() wraps handler execution with try/catch, returning successContent or errorContent.
    export async function safeTool<T>(fn: () => Promise<T>): Promise<ReturnType<typeof successContent> | ReturnType<typeof errorContent>> {
      try {
        const result = await fn();
        return successContent(result);
      } catch (error) {
        return errorContent(error);
      }
    }
Behavior1/5

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

No annotations are provided, and the description does not disclose any behavioral traits such as read-only nature, authentication requirements, pagination, or potential large result sets. The agent is left uninformed about invocation behavior.

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

Conciseness2/5

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

The description is extremely concise (one sentence), but it is under-specified. Brevity here sacrifices essential information, making it insufficient for effective tool use.

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

Completeness1/5

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

Given three parameters and no output schema, the description is far from complete. It does not explain return values, pagination, or how to construct a valid request, severely limiting an AI agent's ability to use the tool correctly.

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?

The input schema has 0% description coverage, and the description fails to explain the purpose of the three parameters (limit, vpc_id, region). Without this, the agent cannot correctly use filtering or pagination.

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 'List all subnets' clearly identifies the action and resource, differentiating from sibling tools like vpc_list_vpcs. However, it implies listing all subnets without acknowledging filtering parameters (vpc_id, region), which could be misleading.

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 on when to use this tool versus alternatives like vpc_create_subnet or vpc_delete_subnet. The description lacks context about prerequisites or typical use cases.

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