list_regions
Retrieve all available Linode cloud regions to determine where to deploy or manage instances.
Instructions
List all available Linode regions
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The handler function for the 'list_regions' tool. It uses the LinodeClient to fetch all regions, processes them into a list of dictionaries with id, country, status, and capabilities, and returns the JSON string. Includes error handling. Registered via the @mcp_server.tool() decorator.@mcp_server.tool() def list_regions() -> str: """List all available Linode regions""" try: # Get the regions list regions_list = linode_client.regions() # Process each region in the collection result = [] # Type annotation to help linter for item in regions_list: # Cast to Region type to resolve linting issues region = cast(Region, item) result.append({ "id": region.id, "country": region.country, "status": region.status, "capabilities": region.capabilities }) return json.dumps(result) except Exception as e: logger.error(f"Error listing regions: {str(e)}") return json.dumps({"error": str(e)})
- src/linode_mcp/server.py:53-55 (registration)The call to register_tools(mcp, linode_client) which triggers the registration of the list_regions tool (and others) via decorators in linode_tools.py.# Register tools from the linode_tools module logger.debug("Registering Linode tools with MCP server") register_tools(mcp, linode_client)
- src/linode_mcp/tools/linode_tools.py:9-9 (registration)The register_tools function where the @mcp_server.tool() decorators are applied to define and register the list_regions tool.def register_tools(mcp_server: Any, linode_client: LinodeClient):