slb_list
List Server Load Balancer (SLB) instances in a specified Alibaba Cloud region by providing the region ID.
Instructions
List Server Load Balancers (SLB).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| regionId | No |
Implementation Reference
- src/tools/slb/index.ts:5-18 (registration)Registration of the 'slb_list' tool, returning the tool metadata including its name, description, and input schema (regionId). Registered in src/index.ts via registerSlbTools().
export function registerSlbTools() { return [ { name: "slb_list", description: "List Server Load Balancers (SLB).", inputSchema: { type: "object", properties: { regionId: { type: "string" } } } } ]; } - src/tools/slb/index.ts:20-38 (handler)Handler for 'slb_list'. Creates an SLB API client, parses args with Zod (regionId defaults to config region), then calls DescribeLoadBalancers API via POST and returns the result as text JSON content.
export async function handleSlbTools(name: string, args: any) { // @ts-ignore const client = new Core.default({ accessKeyId: config.ALIBABA_CLOUD_ACCESS_KEY_ID, accessKeySecret: config.ALIBABA_CLOUD_ACCESS_KEY_SECRET, endpoint: 'https://slb.aliyuncs.com', apiVersion: '2014-05-15', }); if (name === "slb_list") { const parsed = z.object({ regionId: z.string().default(config.ALIBABA_CLOUD_REGION_ID) }).parse(args); return { content: [{ type: "text", text: JSON.stringify(await client.request('DescribeLoadBalancers', { RegionId: parsed.regionId }, { method: 'POST' }), null, 2) }] }; } throw new Error(`Unknown SLB tool: ${name}`); } - src/tools/slb/index.ts:10-15 (schema)Input schema for 'slb_list' tool: a JSON object with an optional regionId string property.
inputSchema: { type: "object", properties: { regionId: { type: "string" } } } - src/index.ts:16-16 (registration)Import and registration of registerSlbTools and handleSlbTools in the main server file.
import { registerSlbTools, handleSlbTools } from "./tools/slb/index.js"; - src/index.ts:69-71 (handler)Routing for slb_* tools: calls handleSlbTools when tool name starts with 'slb_'.
if (name.startsWith("slb_")) { return await handleSlbTools(name, args); }