Skip to main content
Glama
Red5d

Beszel MCP Server

by Red5d

query_container_stats

Retrieve time-series statistics for container CPU, memory, and network usage by specifying container ID and optional time range parameters.

Instructions

Query statistics for a specific container.

Args: container_id: The container ID to query statistics for start_time: Start time in ISO 8601 format (e.g., '2024-01-01T00:00:00Z') end_time: End time in ISO 8601 format page: Page number (default: 1) per_page: Number of results per page (default: 100)

Returns: Dictionary containing time-series data for container CPU, memory, and network usage

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
container_idYes
start_timeNo
end_timeNo
pageNo
per_pageNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main asynchronous handler function for the query_container_stats tool, registered via @mcp.tool() decorator. It handles input parameters, authenticates with PocketBase, constructs filters for the specific container and time range, and delegates to PocketBaseClient.query_stats to retrieve paginated time-series statistics from the 'container_stats' collection.
    @mcp.tool()
    async def query_container_stats(
        container_id: str,
        start_time: Optional[str] = None,
        end_time: Optional[str] = None,
        page: int = 1,
        per_page: int = 100,
    ) -> dict:
        """Query statistics for a specific container.
        
        Args:
            container_id: The container ID to query statistics for
            start_time: Start time in ISO 8601 format (e.g., '2024-01-01T00:00:00Z')
            end_time: End time in ISO 8601 format
            page: Page number (default: 1)
            per_page: Number of results per page (default: 100)
        
        Returns:
            Dictionary containing time-series data for container CPU, memory, and network usage
        """
        client = get_client()
        await ensure_authenticated(client)
        
        # Build filter for container and time range
        filters = [f"container = '{container_id}'"]
        
        time_filter = client.build_time_filter("created", start_time, end_time)
        if time_filter:
            filters.append(time_filter)
        
        return await client.query_stats(
            collection="container_stats",
            filter=" && ".join(filters),
            page=page,
            per_page=per_page,
            sort="-created",
        )
  • Helper method on PocketBaseClient class invoked by the tool handler. It performs the actual API query to PocketBase by calling get_list with the provided filter, pagination, and sorting parameters on the specified stats collection (e.g., 'container_stats').
    async def query_stats(
        self,
        collection: str,
        filter: str,
        page: int = 1,
        per_page: int = 100,
        sort: str = "-created",
    ) -> dict[str, Any]:
        """Query statistics records with filtering.
        
        Args:
            collection: The stats collection name (system_stats or container_stats)
            filter: PocketBase filter string
            page: Page number
            per_page: Number of records per page
            sort: Sort order
            
        Returns:
            Dictionary containing paginated statistics
        """
        return await self.get_list(
            collection=collection,
            page=page,
            per_page=per_page,
            filter=filter,
            sort=sort,
        )
  • Utility method on PocketBaseClient used by the tool handler to construct PocketBase-compatible filter strings for time-range queries on stats records.
    def build_time_filter(
        self,
        field: str,
        start_time: Optional[str] = None,
        end_time: Optional[str] = None,
    ) -> str:
        """Build a time-based filter string.
        
        Args:
            field: The field name (e.g., "created")
            start_time: Start time in ISO 8601 format
            end_time: End time in ISO 8601 format
            
        Returns:
            PocketBase filter string
        """
        filters = []
        
        if start_time:
            filters.append(f"{field} >= '{start_time}'")
        if end_time:
            filters.append(f"{field} <= '{end_time}'")
            
        return " && ".join(filters) if filters else ""
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions that the tool returns time-series data with pagination (via 'page' and 'per_page'), which adds some context. However, it lacks critical details like whether this is a read-only operation, potential rate limits, authentication requirements, or error handling for invalid inputs. For a query tool with no annotations, this leaves significant gaps.

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 well-structured and appropriately sized. It starts with a clear purpose sentence, followed by organized sections for 'Args' and 'Returns'. Each sentence earns its place by providing essential information without redundancy, making it easy to scan and understand.

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

Completeness4/5

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

Given the tool's complexity (5 parameters, time-series querying) and the presence of an output schema (which handles return values), the description is largely complete. It covers all parameters and the general return structure. However, without annotations, it misses behavioral aspects like safety or performance, and it doesn't fully address sibling tool differentiation, leaving minor gaps.

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

Parameters4/5

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

Schema description coverage is 0%, so the description must compensate. It effectively documents all 5 parameters: 'container_id' (the ID to query), 'start_time' and 'end_time' (time range in ISO 8601 format), and 'page'/'per_page' (pagination with defaults). This adds substantial meaning beyond the bare schema, though it doesn't explain edge cases like null values for times. With 0% coverage, this is strong but not perfect.

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 tool's purpose: 'Query statistics for a specific container.' This specifies the verb ('query') and resource ('statistics for a specific container'), making it easy to understand. However, it doesn't explicitly differentiate from sibling tools like 'query_system_stats' or 'list_containers', which would require a 5.

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. It doesn't mention sibling tools like 'query_system_stats' (for system-level stats) or 'list_containers' (for listing containers), nor does it specify prerequisites or exclusions. Usage is implied only by the purpose statement.

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

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/Red5d/beszel-mcp'

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