Skip to main content
Glama
Red5d

Beszel MCP Server

by Red5d

query_system_stats

Retrieve time-series statistics for CPU, memory, disk, and network usage from a specified system by providing its ID and optional time range.

Instructions

Query statistics for a specific system.

Args: system_id: The system 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 CPU, memory, disk, and network usage

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
system_idYes
start_timeNo
end_timeNo
pageNo
per_pageNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main async handler function implementing the query_system_stats tool logic, including registration via @mcp.tool(), input parameters defining the schema, docstring description, client authentication, filter building, and querying of system_stats collection.
    @mcp.tool()
    async def query_system_stats(
        system_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 system.
        
        Args:
            system_id: The system 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 CPU, memory, disk, and network usage
        """
        client = get_client()
        await ensure_authenticated(client)
        
        # Build filter for system and time range
        filters = [f"system = '{system_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="system_stats",
            filter=" && ".join(filters),
            page=page,
            per_page=per_page,
            sort="-created",
        )
  • PocketBaseClient helper method invoked by the tool handler to perform the actual paginated query on the stats collection using PocketBase API.
    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,
        )
  • PocketBaseClient helper method used by the tool handler to construct time range filters for the query.
    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 pagination defaults and return format, which adds some context, but fails to cover critical aspects like authentication requirements, rate limits, error conditions, or whether the query is read-only or has side effects. For a stats query tool with zero annotation coverage, 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.

Conciseness4/5

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

The description is well-structured with a brief purpose statement followed by clear sections for Args and Returns. Each sentence adds value, and there's no redundant information. It could be slightly more front-loaded by emphasizing the tool's scope relative to siblings, but overall it's efficient and organized.

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 complexity (5 parameters, time-series querying) and the presence of an output schema (which handles return values), the description is moderately complete. It covers parameters well but lacks behavioral context (e.g., auth, errors) and usage guidelines. With no annotations and incomplete behavioral disclosure, it meets a baseline but has clear 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?

The description adds substantial meaning beyond the input schema, which has 0% schema description coverage. It explains each parameter's purpose (e.g., 'system_id: The system ID to query statistics for'), specifies formats (ISO 8601 for times), and provides defaults. This compensates well for the schema's lack of descriptions, though it doesn't detail constraints like time range validity.

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 as 'Query statistics for a specific system,' which is a specific verb+resource combination. However, it doesn't explicitly differentiate from sibling tools like 'query_container_stats' or 'list_systems,' which likely serve related but distinct purposes. The description is clear but lacks sibling differentiation.

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. With siblings like 'query_container_stats' and 'list_systems,' there's no indication of whether this tool is for system-level stats, container-level stats, or how it differs from general listing tools. The absence of usage context leaves the agent without 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

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