Skip to main content
Glama

list_tools

Discover available MCP tools in the Splunk server to understand their functions and parameters for data interaction.

Instructions

List all available MCP tools.

Returns:
    List of all available tools with their name, description, and parameters.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The `list_tools` MCP tool handler. Registered via `@mcp.tool()` decorator. Returns a list of all available tools by inspecting the MCP server's internal tools registry (trying mcp._tools, mcp.tools(), or mcp.registered_tools). No input parameters required.
    @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
  • splunk_mcp.py:787-787 (registration)
    Registration of the `list_tools` tool using the FastMCP `@mcp.tool()` decorator, which also infers the input schema from the function signature (empty parameters).
    @mcp.tool()

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/livehybrid/splunk-mcp'

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