list_tools
Discover all available tools on the splunk-mcp server, including their names, descriptions, and parameters, to streamline Splunk Enterprise/Cloud interactions.
Instructions
List all available MCP tools.
Returns:
List of all available tools with their name, description, and parameters.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- splunk_mcp.py:787-862 (handler)Implementation of the 'list_tools' MCP tool. The function is registered via the @mcp.tool() decorator and implements the core logic to dynamically list all available MCP tools by accessing internal mcp server tool registries.@mcp.tool() async def list_tools() -> List[Dict[str, Any]]: """ List all available MCP tools. Returns: List of all available tools with their name, description, and parameters. """ try: logger.info("🧰 Listing available MCP tools...") tools_list = [] # Try to access tools from different potential attributes if hasattr(mcp, '_tools') and isinstance(mcp._tools, dict): # Direct access to the tools dictionary for name, tool_info in mcp._tools.items(): try: tool_data = { "name": name, "description": tool_info.get("description", "No description available"), "parameters": tool_info.get("parameters", {}) } tools_list.append(tool_data) except Exception as e: logger.warning(f"⚠️ Error processing tool {name}: {str(e)}") continue elif hasattr(mcp, 'tools') and callable(getattr(mcp, 'tools', None)): # Tools accessed as a method for name, tool_info in mcp.tools().items(): try: tool_data = { "name": name, "description": tool_info.get("description", "No description available"), "parameters": tool_info.get("parameters", {}) } tools_list.append(tool_data) except Exception as e: logger.warning(f"⚠️ Error processing tool {name}: {str(e)}") continue elif hasattr(mcp, 'registered_tools') and isinstance(mcp.registered_tools, dict): # Access through registered_tools attribute for name, tool_info in mcp.registered_tools.items(): try: description = ( tool_info.get("description", None) or getattr(tool_info, "description", None) or "No description available" ) parameters = ( tool_info.get("parameters", None) or getattr(tool_info, "parameters", None) or {} ) tool_data = { "name": name, "description": description, "parameters": parameters } tools_list.append(tool_data) except Exception as e: logger.warning(f"⚠️ Error processing tool {name}: {str(e)}") continue # Sort tools by name for consistent ordering tools_list.sort(key=lambda x: x["name"]) logger.info(f"✅ Found {len(tools_list)} tools") return tools_list except Exception as e: logger.error(f"❌ Error listing tools: {str(e)}") raise