UNPKG

@quorum-us/opsgenie-mcp

Version:

MCP server for Opsgenie alert management with comprehensive filtering, custom queries, and AI-friendly interface

133 lines (107 loc) 3.08 kB
# Opsgenie Query Examples This document provides examples of how to use the `listAlerts_Opsgenie` tool with both individual filters and custom queries. ## Using Individual Filters When you don't provide a `query` parameter, you can use individual filter parameters: ```json { "status": "open", "priority": "P1", "message": "database", "source": "monitoring", "owner": "john.doe", "tags": ["production", "critical"], "teams": ["backend", "devops"] } ``` ## Using Custom Queries (AI Full Control) When you provide a `query` parameter, it takes precedence over ALL other filters. This gives AI assistants full control over the search. ### Basic Status and Priority ```json { "query": "status: open AND priority: P1" } ``` ### Message and Team Filtering ```json { "query": "message: database* AND teams: backend" } ``` ### Complex Multi-Condition Queries ```json { "query": "tag: production AND source: monitoring AND (priority: P1 OR priority: P2)" } ``` ### Time-Based Queries ```json { "query": "createdAt > 2024-01-01 AND status: open" } ``` ### Advanced Pattern Matching ```json { "query": "message: *error* AND NOT message: *timeout* AND teams: (backend OR frontend)" } ``` ### Integration-Specific Queries ```json { "query": "integration.name: Datadog AND priority: P1 AND acknowledged: false" } ``` ### Owner and Responder Queries ```json { "query": "owner: john.doe OR responders: jane.smith" } ``` ### Tag Combinations ```json { "query": "tag: production AND tag: database AND NOT tag: maintenance" } ``` ## Opsgenie Query Syntax Reference ### Operators - `AND` - Both conditions must be true - `OR` - Either condition must be true - `NOT` - Condition must be false - `()` - Group conditions ### Comparison Operators - `:` - Equals - `>` - Greater than - `<` - Less than - `>=` - Greater than or equal - `<=` - Less than or equal ### Wildcards - `*` - Match any characters - `?` - Match single character ### Common Fields - `status` - open, acknowledged, closed - `priority` - P1, P2, P3, P4, P5 - `message` - Alert message content - `source` - Alert source - `owner` - Alert owner - `teams` - Team names - `tag` - Alert tags - `createdAt` - Creation timestamp - `updatedAt` - Last update timestamp - `acknowledged` - true/false - `integration.name` - Integration name - `integration.type` - Integration type ## Best Practices for AI Assistants 1. **Use custom queries for complex filtering** - When you need multiple conditions or complex logic, use the `query` parameter. 2. **Use individual filters for simple cases** - For basic filtering by status or priority, individual parameters are clearer. 3. **Combine with pagination** - Always consider using `limit` and `offset` for large result sets. 4. **Sort results appropriately** - Use `sort` and `order` parameters to get the most relevant results first. Example of a comprehensive query: ```json { "query": "status: open AND priority: (P1 OR P2) AND tag: production AND NOT tag: maintenance", "sort": "lastOccurredAt", "order": "desc", "limit": 50 } ```