Skip to main content
Glama
brevdev

Brev

Official
by brevdev

get_instance_types

Retrieve available instance types for cloud providers to optimize resource selection for ML model deployment. Supports AWS, GCP, Azure, and more.

Instructions

Get available instances types for a cloud provider

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cloud_providerYesThe cloud provider to get instance types for

Implementation Reference

  • MCP tool handler function that validates the cloud_provider argument, fetches instance types using get_provider_instance_types, and formats the response as TextContent.
    async def get_instance_types_tool(args: dict[str, str]) -> TextContent:
        if "cloud_provider" not in args:
            raise ValueError("cloud_provider argument is required for get_instance_types tool")
    
        cloud_provider = CloudProvider(args["cloud_provider"])
        instance_types = await get_provider_instance_types(cloud_provider)
        return [
            TextContent(
                type="text", 
                text=instance_types
            )
        ]
  • Input schema definition for the get_instance_types tool, specifying the required cloud_provider parameter with enum values from CloudProvider.
    inputSchema={
        "type": "object",
        "properties": {
            "cloud_provider": {
                "description": "The cloud provider to get instance types for",
                "enum": [provider.value for provider in CloudProvider]
            }
        },
        "required": ["cloud_provider"]
    }
  • Registration of the get_instance_types tool in the tool_models dictionary, linking the tool schema, description, and handler function.
    "get_instance_types": ToolModel(
        tool=Tool(
            name="get_instance_types",
            description="Get available instances types for a cloud provider",
            inputSchema={
                "type": "object",
                "properties": {
                    "cloud_provider": {
                        "description": "The cloud provider to get instance types for",
                        "enum": [provider.value for provider in CloudProvider]
                    }
                },
                "required": ["cloud_provider"]
            }
        ),
        call_tool=get_instance_types_tool
    ),
  • Helper function that retrieves all instance types from the API, filters and selects those for the given provider, and returns a formatted JSON string.
    async def get_provider_instance_types(provider: CloudProvider)-> str:
        try:
            all_instance_types_obj = await get_instance_types()
            instance_types = filter_instance_types(all_instance_types_obj)
            for cloud_provider, instance_type_list in instance_types.items():
                logger.info(f"Number of instance types for {cloud_provider.value}: {len(instance_type_list)}")
            if provider not in instance_types:
                raise ValueError(f"Provider {provider.value} not found in instance types")
            instance_type_dicts = [
                instance_type.model_dump(exclude_none=True) 
                for instance_type in instance_types[provider]
            ] 
            return json.dumps(instance_type_dicts, indent=2)
        except Exception as e:
            logger.error(f"Error getting instance types: {str(e)}")
            raise RuntimeError(f"Failed to get instance types: {str(e)}")
  • Core helper function that performs the HTTP API call to Brev's endpoint to fetch all available instance types, validates the response, and returns the parsed object.
    async def get_instance_types() -> AllInstanceTypeObj:
        access_token = get_acess_token() 
        org_id = get_active_org_id()
        try:
            async with httpx.AsyncClient(timeout=httpx.Timeout(25.0)) as client:
                response = await client.get(
                    f"{BASE_API_URL}/instances/alltypesavailable/{org_id}",
                    headers={
                        "Authorization": f"Bearer {access_token}",
                        "Content-Type": "application/json"
                    },
                )
                response.raise_for_status()
                data = response.json()
                all_instance_types_obj = AllInstanceTypeObj.model_validate(data)
                return all_instance_types_obj
        except ValidationError as e:    
            raise RuntimeError(f"Failed to validate instance types: {str(e)}")
        except Exception as e:
            raise RuntimeError(f"Failed to get instance types: {str(e)}")
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions 'Get available instance types' but doesn't specify if this is a read-only operation, requires authentication, has rate limits, or what the output format might be. This leaves significant gaps in understanding the tool's behavior.

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

Conciseness5/5

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

The description is a single, clear sentence that efficiently conveys the tool's purpose without any unnecessary words. It is front-loaded and appropriately sized, making it easy to parse quickly.

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

Completeness3/5

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

Given the tool's simplicity (one parameter with full schema coverage) and lack of output schema, the description is minimally adequate. However, it doesn't compensate for the absence of annotations or output details, leaving the agent with incomplete context about the tool's full behavior and results.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, with the parameter 'cloud_provider' well-documented in the schema, including an enum list. The description adds no additional meaning beyond what the schema provides, such as explaining the significance of the provider choice, so it meets the baseline for high schema coverage.

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 clearly states the action ('Get') and resource ('available instance types for a cloud provider'), making the purpose immediately understandable. However, it doesn't differentiate from the sibling tool 'create_workspace', which is unrelated, so it doesn't fully earn the highest score for sibling distinction.

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?

The description provides no guidance on when to use this tool versus alternatives or any prerequisites. It simply states what it does without context about timing, constraints, or comparisons to other tools, leaving the agent with minimal usage direction.

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

Related 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/brevdev/brev-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server