Skip to main content
Glama
PovedaAqui

SuzieQ MCP Server

run_suzieq_show

Execute network observability queries using SuzieQ REST API. Specify a table (e.g., 'device', 'bgp') and optional filters (e.g., hostname, state) to retrieve structured network data in JSON format.

Instructions

Runs a SuzieQ 'show' query via its REST API.

Args:
    table: The name of the SuzieQ table to query (e.g., 'device', 'bgp', 'interface', 'route').
    filters: An optional dictionary of filter parameters for the SuzieQ query
             (e.g., {"hostname": "leaf01", "vrf": "default", "state": "Established"}).
             Keys should match SuzieQ filter names. Values can be strings or lists of strings.
             If no filters are needed, this can be None, null, or an empty dictionary.

Returns:
    A JSON string representing the result from the SuzieQ API, or a JSON string with an error message.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filtersNo
tableYes

Implementation Reference

  • The primary handler function for the MCP tool 'run_suzieq_show'. It is decorated with @mcp.tool() for registration and executes the tool logic by calling the _query_suzieq_api helper with verb='show', processes the result, and returns a formatted JSON string.
    @mcp.tool()
    async def run_suzieq_show(table: str, filters: Optional[Dict[str, Any]] = None) -> str:
        """
        Runs a SuzieQ 'show' query via its REST API.
    
        Args:
            table: The name of the SuzieQ table to query (e.g., 'device', 'bgp', 'interface', 'route').
            filters: An optional dictionary of filter parameters for the SuzieQ query
                     (e.g., {"hostname": "leaf01", "vrf": "default", "state": "Established"}).
                     Keys should match SuzieQ filter names. Values can be strings or lists of strings.
                     If no filters are needed, this can be None, null, or an empty dictionary.
    
        Returns:
            A JSON string representing the result from the SuzieQ API, or a JSON string with an error message.
        """
        actual_filters = filters if isinstance(filters, dict) else None
    
        # Call the generalized helper function with verb='show'
        result = await _query_suzieq_api(verb="show", table=table, params=actual_filters)
    
        try:
            # Serialize the result dictionary to a JSON string
            return json.dumps(result, indent=2, ensure_ascii=False)
        except TypeError as e:
            error_message = f"Error serializing SuzieQ 'show' response to JSON: {str(e)}"
            print(f"[ERROR] {error_message}") # Debug print
            return json.dumps({"error": error_message})
  • Supporting utility function that performs the core HTTP API interaction with the SuzieQ server, handling authentication, requests, responses, and errors. This is called by the run_suzieq_show handler.
    async def _query_suzieq_api(verb: str, table: str, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        """
        Asynchronously queries the SuzieQ REST API for a given verb and table.
    
        Args:
            verb: The SuzieQ verb to execute (e.g., 'show', 'summarize').
            table: The SuzieQ table name (e.g., 'device', 'bgp', 'interface').
            params: A dictionary of query parameters for filtering (e.g., {'hostname': 'leaf01', 'vrf': 'default'}).
    
        Returns:
            A dictionary containing the API response or an error message.
        """
        # Check if configuration is missing
        if not SUZIEQ_API_ENDPOINT or not SUZIEQ_API_KEY:
            error_msg = "SuzieQ API endpoint or key not configured. Set SUZIEQ_API_ENDPOINT and SUZIEQ_API_KEY environment variables or in .env file."
            print(f"[ERROR] {error_msg}") # Log configuration error
            return {"error": error_msg}
    
        # Construct the API URL using the provided verb and table
        api_endpoint_clean = SUZIEQ_API_ENDPOINT.rstrip('/')
        # Assuming the API structure follows /{table}/{verb} pattern
        api_url = f"{api_endpoint_clean}/{table}/{verb}"
    
        # --- Authentication ---
        # Prepare parameters, adding the API key as 'access_token' query parameter
        query_params = params if params else {}
        query_params["access_token"] = SUZIEQ_API_KEY # Add key as query param
        query_params["format"] = "json" # Ensure response is JSON
        headers = {} # No custom headers needed now for auth
        # ---------------------------
    
        async with httpx.AsyncClient() as client:
            try:
                # Use headers={}, params=query_params
                print(f"[INFO] Querying SuzieQ API: {api_url} with params: {query_params}") # Debug print
                response = await client.get(api_url, headers=headers, params=query_params, timeout=30.0)
                print(f"[INFO] SuzieQ API Response Status: {response.status_code}") # Debug print
                response.raise_for_status()  # Raise an exception for bad status codes (4xx or 5xx)
    
                if response.status_code == 204:
                    return {"warning": f"Received empty response (204 No Content) from SuzieQ API for {verb} {table}"}
    
                content_type = response.headers.get('content-type', '')
                if 'application/json' in content_type:
                    return response.json()
                else:
                    error_detail = f"Unexpected content type received: {content_type}. Response text: {response.text}"
                    print(f"[ERROR] {error_detail}")
                    return {"error": error_detail}
            except httpx.HTTPStatusError as e:
                error_detail = f"HTTP error occurred: {e.response.status_code} - {e.response.text}"
                print(f"[ERROR] {error_detail}") # Debug print
                return {"error": error_detail}
            except httpx.RequestError as e:
                error_detail = f"An error occurred while requesting {e.request.url!r}: {e}"
                print(f"[ERROR] {error_detail}") # Debug print
                return {"error": error_detail}
            except json.JSONDecodeError as e:
                error_detail = f"Failed to decode JSON response from SuzieQ API: {e}. Response text: {response.text}"
                print(f"[ERROR] {error_detail}")
                return {"error": error_detail}
            except Exception as e:
                error_detail = f"An unexpected error occurred: {str(e)}"
                print(f"[ERROR] {error_detail}") # Debug print
                return {"error": error_detail}
  • server.py:92-92 (registration)
    The @mcp.tool() decorator registers the run_suzieq_show function as an MCP tool.
    @mcp.tool()
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions the REST API mechanism and error handling in returns, but doesn't cover important aspects like rate limits, authentication needs, timeout behavior, or what constitutes valid table names beyond examples. For a tool with no annotation coverage, this leaves significant gaps in understanding operational constraints.

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 clear sections (Args, Returns) and uses bullet-like formatting for parameter details. While somewhat verbose, each sentence adds value by explaining parameter usage. The front-loaded purpose statement is clear, though some details could be more concise.

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 has no annotations, no output schema, and 2 parameters, the description does a good job with parameter semantics but lacks completeness in other areas. It doesn't explain the return structure beyond 'JSON string', doesn't cover error scenarios comprehensively, and omits behavioral constraints. For a query tool with REST API dependencies, more operational context would be helpful.

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

Parameters5/5

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

With 0% schema description coverage, the description fully compensates by providing comprehensive parameter documentation. It clearly explains both parameters: 'table' with specific examples and 'filters' with detailed syntax, format examples, and handling of optional/null values. The description adds substantial meaning beyond what the bare schema provides.

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 ('Runs a SuzieQ show query') and mechanism ('via its REST API'), providing a specific verb+resource combination. It distinguishes from the sibling tool 'run_suzieq_summarize' by specifying this is for 'show' queries rather than 'summarize' operations, though it doesn't explicitly contrast them in the text.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context through the examples of tables and filters, suggesting when to use this tool for querying network data. However, it lacks explicit guidance on when to choose this over 'run_suzieq_summarize' or other alternatives, and doesn't mention prerequisites like API connectivity or authentication requirements.

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/PovedaAqui/suzieq-mcp'

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