get_scheduled_query
Retrieve detailed information about a specific scheduled query by ID, including SQL, schedule configuration, and metadata, using the Panther MCP Server. Supports security monitoring and data lake query management.
Instructions
Get detailed information about a specific scheduled query by ID.
Returns complete scheduled query information including SQL, schedule configuration, and metadata.
Returns: Dict containing: - success: Boolean indicating if the query was successful - query: Scheduled query information if successful, containing: - id: Query ID - name: Query name - description: Query description - sql: The SQL query text - schedule: Schedule configuration (cron, rate, timeout) - managed: Whether the query is managed by Panther - createdAt: Creation timestamp - updatedAt: Last update timestamp - message: Error message if unsuccessful
Permissions:{'all_of': ['Query Data Lake']}
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query_id | Yes | The ID of the scheduled query to fetch (must be a UUID) |
Implementation Reference
- The core handler function that implements the get_scheduled_query tool logic. It fetches the scheduled query details from the Panther API endpoint /queries/{query_id} using the REST client and returns a structured response with success status and query data or error message.async def get_scheduled_query( query_id: Annotated[ UUID, Field( description="The ID of the scheduled query to fetch (must be a UUID)", examples=["6c6574cb-fbf9-49fc-baad-1a99464ef09e"], ), ], ) -> Dict[str, Any]: """Get detailed information about a specific scheduled query by ID. Returns complete scheduled query information including SQL, schedule configuration, and metadata. Returns: Dict containing: - success: Boolean indicating if the query was successful - query: Scheduled query information if successful, containing: - id: Query ID - name: Query name - description: Query description - sql: The SQL query text - schedule: Schedule configuration (cron, rate, timeout) - managed: Whether the query is managed by Panther - createdAt: Creation timestamp - updatedAt: Last update timestamp - message: Error message if unsuccessful """ logger.info(f"Fetching scheduled query: {query_id}") try: # Execute the REST API call async with get_rest_client() as client: response_data, status_code = await client.get(f"/queries/{str(query_id)}") logger.info(f"Successfully retrieved scheduled query: {query_id}") # Format the response return { "success": True, "query": response_data, } except Exception as e: logger.error(f"Failed to fetch scheduled query: {str(e)}") return { "success": False, "message": f"Failed to fetch scheduled query: {str(e)}", }
- The @mcp_tool decorator registers get_scheduled_query in the internal tool registry with required permissions (DATA_ANALYTICS_READ) and read-only hint.@mcp_tool( annotations={ "permissions": all_perms(Permission.DATA_ANALYTICS_READ), "readOnlyHint": True, } )
- src/mcp_panther/server.py:75-75 (registration)The call to register_all_tools(mcp) which registers all tools from the registry, including get_scheduled_query, with the FastMCP server instance.register_all_tools(mcp)
- Pydantic-based input schema definition for the query_id parameter, enforcing UUID type with description and example.query_id: Annotated[ UUID, Field( description="The ID of the scheduled query to fetch (must be a UUID)", examples=["6c6574cb-fbf9-49fc-baad-1a99464ef09e"], ), ],