list_networks
Retrieve a list of available cloud networks on the Civo platform to manage and configure your infrastructure resources.
Instructions
List available networks on Civo
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/api/networks.ts:11-25 (handler)Core handler function that executes the logic to list networks from the Civo API.export async function listNetworks(): Promise<Network[]> { const url = `${CIVO_API_URL}/networks`; const response = await fetch(url, { headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${CIVO_API_KEY}`, }, }); if (!response.ok) { throw new Error(`Failed to list networks: ${response.statusText}`); } return await response.json(); }
- src/tools/networks.ts:3-10 (schema)Input schema and metadata definition for the list_networks tool.export const LIST_NETWORKS_TOOL: Tool = { name: 'list_networks', description: 'List available networks on Civo', inputSchema: { type: 'object', properties: {}, }, };
- src/index.ts:82-82 (registration)Registration of the list_networks tool schema in server capabilities.tools.[LIST_NETWORKS_TOOL.name]: LIST_NETWORKS_TOOL,
- src/index.ts:109-109 (registration)Inclusion of the list_networks tool in the ListTools response.LIST_NETWORKS_TOOL,
- src/index.ts:362-377 (handler)MCP protocol handler in the CallToolRequestSchema switch case, which calls the core listNetworks function and formats the response.case 'list_networks': { const networks = await listNetworks(); const networkList = networks .map((n: any) => `${n.name} (${n.id}) - ${n.label}`) .join('\n'); return { content: [ { type: 'text', text: `Available Networks:\n${networkList}`, }, ], isError: false, }; }