list_regions
Retrieve a list of available regions on Civo for deploying cloud resources.
Instructions
List available regions on Civo
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:345-360 (handler)Handles the 'list_regions' tool call by invoking listRegions() API function and formatting region names/codes into a text response.
case 'list_regions': { const regions = await listRegions(); const regionList = regions .map((r: any) => `${r.name} (${r.code})`) .join('\n'); return { content: [ { type: 'text', text: `Available Regions:\n${regionList}`, }, ], isError: false, }; } - src/tools/regions.ts:3-10 (schema)Defines the tool schema for 'list_regions' with no required input parameters.
export const LIST_REGIONS_TOOL: Tool = { name: 'list_regions', description: 'List available regions on Civo', inputSchema: { type: 'object', properties: {}, }, }; - src/api/regions.ts:11-25 (helper)API helper that fetches regions from the Civo API endpoint (https://api.civo.com/v2/regions) with Bearer token auth.
export async function listRegions(): Promise<Region[]> { const url = `${CIVO_API_URL}/regions`; const response = await fetch(url, { headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${CIVO_API_KEY}`, }, }); if (!response.ok) { throw new Error(`Failed to list regions: ${response.statusText}`); } return await response.json(); } - src/index.ts:108-108 (registration)Registers the tool in the ListToolsRequestHandler, making it available in the tools list.
LIST_REGIONS_TOOL, - src/index.ts:81-81 (registration)Registers the tool in the server capabilities on construction.
[LIST_REGIONS_TOOL.name]: LIST_REGIONS_TOOL,