Skip to main content
Glama
ajragusa

perfsonar-mcp

by ajragusa

query_measurements

Query network performance measurements from perfSONAR archives to analyze throughput, latency, and packet loss data with customizable filters.

Instructions

Query perfSONAR measurements with optional filters. Returns metadata about available measurements.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sourceNoSource host/IP address
destinationNoDestination host/IP address
eventTypeNoEvent type to filter
toolNameNoTool name to filter
timeRangeNoTime range in seconds

Implementation Reference

  • The handler function `query_measurements` which is exposed as an MCP tool via the fastmcp framework, mapping user inputs to `MeasurementQueryParams` and delegating the actual network call to `perfsonar_client.query_measurements`.
    async def query_measurements(
        source: Optional[str] = None,
        destination: Optional[str] = None,
        eventType: Optional[str] = None,
        toolName: Optional[str] = None,
        timeRange: Optional[int] = None,
    ) -> str:
        """Query perfSONAR measurements with optional filters. Returns metadata about available measurements.
    
        Args:
            source: Source host/IP address
            destination: Destination host/IP address
            eventType: Event type to filter (e.g., 'throughput', 'histogram-owdelay')
            toolName: Tool name to filter (e.g., 'bwctl/iperf3', 'powstream')
            timeRange: Time range in seconds from now
    
        Returns:
            JSON string with measurement metadata
        """
        params = MeasurementQueryParams(
            source=source,
            destination=destination,
            event_type=eventType,
            tool_name=toolName,
            time_range=timeRange,
        )
        results = await perfsonar_client.query_measurements(params)
        return json.dumps([r.model_dump(by_alias=True) for r in results], indent=2)
  • The underlying client method `query_measurements` that performs the actual HTTP request to the perfSONAR service.
    async def query_measurements(
        self, params: Optional[MeasurementQueryParams] = None
    ) -> List[MeasurementMetadata]:
        """
        Query measurements with optional filters
    
        Args:
            params: Query parameters for filtering measurements
    
        Returns:
            List of measurement metadata
        """
        logger.info("Querying measurements")
        logger.debug(f"Query parameters: {params}")
        try:
            query_params = {}
            if params:
                query_params = params.model_dump(by_alias=True, exclude_none=True)
    
            response = await self.client.get("/", params=query_params)
            response.raise_for_status()
    
            data = response.json()
            logger.info(f"Retrieved {len(data)} measurement records")
            return [MeasurementMetadata.model_validate(item) for item in data]
        except httpx.HTTPStatusError as e:
            logger.error(f"HTTP error querying measurements: {e.response.status_code}")
Behavior2/5

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

With no annotations provided, the description carries full burden but only states it 'returns metadata about available measurements.' It doesn't disclose whether this is a read-only operation, potential rate limits, authentication requirements, pagination behavior, error conditions, or what format the metadata takes. The description is minimal and lacks essential behavioral context.

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 a single, efficient sentence that states the core purpose. It's appropriately sized for a query tool, though it could be slightly more informative without losing conciseness. No wasted words or redundant information.

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

Completeness2/5

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

For a query tool with 5 parameters and no output schema or annotations, the description is insufficient. It doesn't explain what 'metadata' includes, how results are structured, whether filtering is AND/OR logic, or any performance characteristics. Given the complexity implied by multiple filter parameters and sibling tools, more context is needed for effective use.

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?

Schema description coverage is 100%, so the schema already documents all 5 parameters thoroughly. The description adds marginal value by mentioning 'optional filters' which aligns with the schema's optional parameters, but doesn't provide additional context about parameter relationships, typical values, or filtering logic beyond what's in the schema.

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 verb ('query') and resource ('perfSONAR measurements') with the purpose of returning metadata about available measurements. It distinguishes itself from siblings like get_measurement_data (which likely returns actual data) by focusing on metadata, but doesn't explicitly contrast with all measurement-related tools.

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 mentions 'optional filters' but provides no guidance on when to use this tool versus alternatives like get_latency, get_throughput, or get_measurement_data. There's no indication of prerequisites, typical use cases, or when other tools might be more appropriate.

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/ajragusa/perfsonar-mcp'

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