Skip to main content
Glama
panther-labs

Panther MCP Server

Official

list_scheduled_queries

Read-only

Retrieve all scheduled SQL queries from Panther for recurring analysis, reporting, and monitoring tasks.

Instructions

List all scheduled queries from your Panther instance.

Scheduled queries are SQL queries that run automatically on a defined schedule for recurring analysis, reporting, and monitoring tasks.

Note: SQL content is excluded from list responses to prevent token limits. Use get_scheduled_query() to retrieve the full SQL for a specific query.

Returns: Dict containing: - success: Boolean indicating if the query was successful - queries: List of scheduled queries if successful, each containing: - id: Query ID - name: Query name - description: Query description - schedule: Schedule configuration (cron, rate, timeout) - managed: Whether the query is managed by Panther - createdAt: Creation timestamp - updatedAt: Last update timestamp - total_queries: Number of queries returned - has_next_page: Boolean indicating if more results are available - next_cursor: Cursor for fetching the next page of results - message: Error message if unsuccessful

Permissions:{'all_of': ['Query Data Lake']}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cursorNoOptional cursor for pagination from a previous query
limitNoMaximum number of results to return (1-1000)
name_containsNoOptional substring to filter scheduled queries by name (case-insensitive)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler function for list_scheduled_queries tool. Includes @mcp_tool decorator for registration, inline Pydantic schema via Annotated[Field], fetches scheduled queries via REST API, removes SQL to avoid token limits, supports pagination and name filtering, returns formatted success/error response.
    @mcp_tool(
        annotations={
            "permissions": all_perms(Permission.DATA_ANALYTICS_READ),
            "readOnlyHint": True,
        }
    )
    async def list_scheduled_queries(
        cursor: Annotated[
            str | None,
            Field(description="Optional cursor for pagination from a previous query"),
        ] = None,
        limit: Annotated[
            int,
            Field(
                description="Maximum number of results to return (1-1000)",
                ge=1,
                le=1000,
            ),
        ] = 100,
        name_contains: Annotated[
            str | None,
            Field(
                description="Optional substring to filter scheduled queries by name (case-insensitive)"
            ),
        ] = None,
    ) -> Dict[str, Any]:
        """List all scheduled queries from your Panther instance.
    
        Scheduled queries are SQL queries that run automatically on a defined schedule
        for recurring analysis, reporting, and monitoring tasks.
    
        Note: SQL content is excluded from list responses to prevent token limits.
        Use get_scheduled_query() to retrieve the full SQL for a specific query.
    
        Returns:
            Dict containing:
            - success: Boolean indicating if the query was successful
            - queries: List of scheduled queries if successful, each containing:
                - id: Query ID
                - name: Query name
                - description: Query description
                - schedule: Schedule configuration (cron, rate, timeout)
                - managed: Whether the query is managed by Panther
                - createdAt: Creation timestamp
                - updatedAt: Last update timestamp
            - total_queries: Number of queries returned
            - has_next_page: Boolean indicating if more results are available
            - next_cursor: Cursor for fetching the next page of results
            - message: Error message if unsuccessful
        """
        logger.info("Listing scheduled queries")
    
        try:
            # Prepare query parameters
            params = {"limit": limit}
            if cursor:
                params["cursor"] = cursor
    
            logger.debug(f"Query parameters: {params}")
    
            # Execute the REST API call
            async with get_rest_client() as client:
                response_data, status_code = await client.get("/queries", params=params)
    
            # Extract queries from response
            queries = response_data.get("results", [])
            next_cursor = response_data.get("next")
    
            # Remove SQL content to prevent token limit issues
            # Full SQL can be retrieved using get_scheduled_query
            for query in queries:
                if "sql" in query:
                    del query["sql"]
    
            # Filter by name_contains if provided
            if name_contains:
                queries = [
                    q for q in queries if name_contains.lower() in q.get("name", "").lower()
                ]
    
            logger.info(f"Successfully retrieved {len(queries)} scheduled queries")
    
            # Format the response
            return {
                "success": True,
                "queries": queries,
                "total_queries": len(queries),
                "has_next_page": bool(next_cursor),
                "next_cursor": next_cursor,
            }
        except Exception as e:
            logger.error(f"Failed to list scheduled queries: {str(e)}")
            return {
                "success": False,
                "message": f"Failed to list scheduled queries: {str(e)}",
            }
  • Import of scheduled_queries module in tools/__init__.py triggers execution of @mcp_tool decorators, adding the tool to the internal registry.
    from . import (
        alerts,
        data_lake,
        data_models,
        detections,
        global_helpers,
        metrics,
        permissions,
        roles,
        scheduled_queries,
        schemas,
        sources,
        users,
    )
  • Final registration of all tools (including list_scheduled_queries) with the MCP server instance by calling register_all_tools(mcp). Note: exact lines approximate; full context confirms the call.
        from .panther_mcp_core.tools.registry import register_all_tools
    
    # Create the MCP server with lifespan context for shared HTTP client management
    # Note: Dependencies are declared in fastmcp.json for FastMCP v2.14.0+
    mcp = FastMCP(MCP_SERVER_NAME, lifespan=lifespan)
    
    # Register all tools with MCP using the registry
    register_all_tools(mcp)
Behavior4/5

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

The annotations provide readOnlyHint=true, which the description doesn't contradict. The description adds valuable behavioral context beyond annotations by explaining that SQL content is excluded from responses to prevent token limits, describing the pagination mechanism (cursor-based), and detailing the return structure. However, it doesn't mention rate limits, authentication needs, or other 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: purpose statement, explanation of scheduled queries, important note about SQL exclusion, usage alternative, and detailed return format. While comprehensive, some information in the 'Returns' section could be considered redundant since an output schema exists, making it slightly longer than strictly necessary.

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

Completeness5/5

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

Given the tool's complexity (list operation with pagination and filtering), the description provides excellent contextual completeness. It explains what scheduled queries are, notes important behavioral constraints (SQL exclusion), provides clear usage guidance with alternatives, details the return structure, and includes permissions information. With both annotations and output schema available, the description adds substantial value without unnecessary repetition.

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?

With 100% schema description coverage, the input schema already fully documents all three parameters (cursor, limit, name_contains). The description doesn't add any parameter-specific information beyond what's in the schema, so it meets the baseline expectation but doesn't provide additional semantic context about how parameters interact or affect results.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/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 with a specific verb ('List') and resource ('all scheduled queries from your Panther instance'), and distinguishes it from the sibling tool get_scheduled_query by noting that SQL content is excluded from list responses. This provides clear differentiation from 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 Guidelines5/5

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

The description explicitly provides usage guidance by stating when to use this tool ('to list all scheduled queries') versus when to use an alternative ('Use get_scheduled_query() to retrieve the full SQL for a specific query'). It also includes important context about SQL content exclusion to prevent token limits, which helps the agent understand when this tool is 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/panther-labs/mcp-panther'

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