list_saved_searches
Retrieve all saved searches from Splunk to view their names, descriptions, and search queries for monitoring and analysis.
Instructions
List all saved searches in Splunk
Returns:
List of saved searches with their names, descriptions, and search queries
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- splunk_mcp.py:426-453 (handler)The main handler function for the 'list_saved_searches' tool. It is registered via the @mcp.tool() decorator and implements the core logic: connects to Splunk service, iterates through all saved searches, extracts name, description, and search query for each, handles errors per item, and returns a list of dictionaries.@mcp.tool() async def list_saved_searches() -> List[Dict[str, Any]]: """ List all saved searches in Splunk Returns: List of saved searches with their names, descriptions, and search queries """ try: service = get_splunk_connection() saved_searches = [] for saved_search in service.saved_searches: try: saved_searches.append({ "name": saved_search.name, "description": saved_search.description or "", "search": saved_search.search }) except Exception as e: logger.warning(f"⚠️ Error processing saved search: {str(e)}") continue return saved_searches except Exception as e: logger.error(f"❌ Failed to list saved searches: {str(e)}") raise