Skip to main content
Glama

list_hardware

Discover available hardware configurations for running AI models to select optimal resources for inference tasks.

Instructions

List available hardware options for running models.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the list_hardware tool. It creates a ReplicateClient context, calls list_hardware on the client, and converts the raw results into a typed HardwareList response.
    async def list_hardware() -> HardwareList: """List available hardware options for running models. Returns: HardwareList containing available hardware options Raises: RuntimeError: If the Replicate client fails to initialize Exception: If the API request fails """ async with ReplicateClient() as client: result = await client.list_hardware() return HardwareList(hardware=[Hardware(**hw) for hw in result])
  • Registers the list_hardware tool with the FastMCP server using the @mcp.tool decorator.
    @mcp.tool( name="list_hardware", description="List available hardware options for running models.", )
  • Pydantic models defining the structure of individual Hardware options and the HardwareList response used by the tool.
    class Hardware(BaseModel): """A hardware option for running models on Replicate.""" name: str = Field(..., description="Human-readable name of the hardware") sku: str = Field(..., description="SKU identifier for the hardware") class HardwareList(BaseModel): """Response format for listing hardware options.""" hardware: List[Hardware]
  • Helper method in ReplicateClient that performs the actual HTTP GET request to the Replicate API's /hardware endpoint and formats the response.
    async def list_hardware(self) -> list[dict[str, str]]: """Get list of available hardware options for running models. Returns: List of hardware options with name and SKU Raises: Exception: If the API request fails """ if not self.client: raise RuntimeError("Client not initialized. Check error property for details.") try: response = await self.http_client.get("/hardware") response.raise_for_status() return [ { "name": hw["name"], "sku": hw["sku"], } for hw in response.json() ] except httpx.HTTPError as err: logger.error(f"HTTP error getting hardware options: {str(err)}") raise Exception(f"Failed to get hardware options: {str(err)}") from err except Exception as err: logger.error(f"Failed to get hardware options: {str(err)}") raise Exception(f"Failed to get hardware options: {str(err)}") from err

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/gerred/mcp-server-replicate'

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