Skip to main content
Glama

axom_mcp_discover

Read-onlyIdempotent

Explore available resources, tools, and capabilities within the Axom MCP Server to support AI agents with environment discovery and tool chaining.

Instructions

Discover available resources, structures, and capabilities.

Discovery Domains:

  • files: List and search files in allowed directories

  • tools: List available MCP tools and their capabilities

  • memory: Explore memory structure and statistics

  • capabilities: Check server capabilities and configuration

  • all: Comprehensive discovery across all domains

Filter Options:

  • pattern: Glob pattern for file filtering (e.g., *.py)

  • type: File type filter (file, directory, all)

  • memory_type: Filter memories by type

  • importance: Filter memories by importance

Chain Support: Use chain parameter to act on discovered resources.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
domainYesDiscovery domain
filterNoFilter criteria
limitNoMaximum results
recursiveNoRecursive discovery
chainNoChain operations based on discovery

Implementation Reference

  • Main handler function that processes axom_mcp_discover tool calls. Validates input using DiscoverInput schema, then dispatches to appropriate discovery domain handlers (files, tools, memory, capabilities, or all). Returns JSON string with results.
    async def handle_discover(arguments: Dict[str, Any]) -> str:
        """Handle axom_mcp_discover tool calls.
    
        Args:
            arguments: Tool arguments containing domain and parameters
    
        Returns:
            JSON string with discovery result
        """
        # Validate input
        input_data = DiscoverInput(**arguments)
        domain = input_data.domain
        filter_criteria = input_data.filter or {}
        limit = input_data.limit or 100
        recursive = input_data.recursive if input_data.recursive is not None else True
    
        try:
            if domain == "files":
                return await _discover_files(filter_criteria, limit, recursive)
            elif domain == "tools":
                return await _discover_tools()
            elif domain == "memory":
                return await _discover_memory(limit)
            elif domain == "capabilities":
                return await _discover_capabilities()
            elif domain == "all":
                return await _discover_all(filter_criteria, limit, recursive)
            else:
                return json.dumps({"error": f"Unknown domain: {domain}"})
        except Exception as e:
            logger.error(f"Discovery failed: {e}")
            return json.dumps({"error": str(e)})
  • Helper function _discover_files that implements file system discovery. Supports pattern matching, file/directory filtering, recursive/non-recursive traversal, and returns file metadata including name, path, type, and size.
    async def _discover_files(
        filter_criteria: Dict[str, Any], limit: int, recursive: bool
    ) -> str:
        """Discover files in allowed directories."""
        results = []
        pattern = filter_criteria.get("pattern", "*")
        file_type = filter_criteria.get("type", "all")  # file, directory, all
        base_path = filter_criteria.get("path", os.getcwd())
    
        try:
            base = _validate_path(base_path)
        except ValueError:
            base = Path(os.getcwd()).resolve()
    
        if not base.exists():
            return json.dumps({"error": f"Path not found: {base_path}"})
    
        def should_include(path: Path) -> bool:
            """Check if path matches filter criteria."""
            # Check pattern
            if not fnmatch.fnmatch(path.name, pattern):
                return False
    
            # Check type
            if file_type == "file" and not path.is_file():
                return False
            if file_type == "directory" and not path.is_dir():
                return False
    
            return True
    
        try:
            if recursive:
                for path in base.rglob("*"):
                    if len(results) >= limit:
                        break
                    if should_include(path):
                        results.append(
                            {
                                "name": path.name,
                                "path": str(path),
                                "relative_path": str(path.relative_to(base)),
                                "type": "file" if path.is_file() else "directory",
                                "size": path.stat().st_size if path.is_file() else None,
                            }
                        )
            else:
                for path in base.iterdir():
                    if len(results) >= limit:
                        break
                    if should_include(path):
                        results.append(
                            {
                                "name": path.name,
                                "path": str(path),
                                "relative_path": str(path.relative_to(base)),
                                "type": "file" if path.is_file() else "directory",
                                "size": path.stat().st_size if path.is_file() else None,
                            }
                        )
        except PermissionError:
            pass  # Skip directories we can't access
    
        # Sort results for deterministic output
        results.sort(key=lambda x: (x["type"], x["name"]))
    
        return json.dumps(
            {
                "success": True,
                "domain": "files",
                "base_path": str(base),
                "count": len(results),
                "results": results,
            }
        )
  • Helper function _discover_tools that returns metadata about all available MCP tools. Includes axom_mcp_memory, axom_mcp_exec, axom_mcp_analyze, axom_mcp_discover, and axom_mcp_transform with their parameters and capabilities.
    async def _discover_tools() -> str:
        """Discover available MCP tools."""
        tools = [
            {
                "name": "axom_mcp_memory",
                "description": "Store, retrieve, search, and manage persistent memories in the Axom database",
                "actions": ["read", "write", "list", "search", "delete"],
                "parameters": {
                    "action": {
                        "type": "string",
                        "required": True,
                        "enum": ["read", "write", "list", "search", "delete"],
                    },
                    "name": {
                        "type": "string",
                        "required": False,
                        "description": "Memory identifier",
                    },
                    "content": {
                        "type": "string",
                        "required": False,
                        "description": "Memory content",
                    },
                    "query": {
                        "type": "string",
                        "required": False,
                        "description": "Search query",
                    },
                    "memory_type": {
                        "type": "string",
                        "enum": ["long_term", "short_term", "reflex", "dreams"],
                    },
                    "importance": {
                        "type": "string",
                        "enum": ["critical", "important", "normal", "low"],
                    },
                    "tags": {"type": "array", "items": {"type": "string"}},
                    "limit": {"type": "integer", "default": 50},
                },
            },
            {
                "name": "axom_mcp_exec",
                "description": "Execute file operations and shell commands with chain-reaction support",
                "operations": ["read", "write", "shell"],
                "parameters": {
                    "operation": {
                        "type": "string",
                        "required": True,
                        "enum": ["read", "write", "shell"],
                    },
                    "target": {
                        "type": "string",
                        "required": True,
                        "description": "File path or command",
                    },
                    "data": {
                        "type": "string",
                        "required": False,
                        "description": "Data to write",
                    },
                    "chain": {
                        "type": "array",
                        "description": "Chain of subsequent operations",
                    },
                },
            },
            {
                "name": "axom_mcp_analyze",
                "description": "Analyze code and data with configurable depth and scope",
                "types": ["debug", "review", "audit", "refactor", "test"],
                "parameters": {
                    "type": {
                        "type": "string",
                        "required": True,
                        "enum": ["debug", "review", "audit", "refactor", "test"],
                    },
                    "target": {
                        "type": "string",
                        "required": True,
                        "description": "File path or code to analyze",
                    },
                    "focus": {
                        "type": "string",
                        "description": "Focus area (e.g., security, performance)",
                    },
                    "depth": {
                        "type": "string",
                        "enum": ["minimal", "low", "medium", "high", "max"],
                        "default": "medium",
                    },
                    "output_format": {
                        "type": "string",
                        "enum": ["summary", "detailed", "actionable"],
                        "default": "summary",
                    },
                },
            },
            {
                "name": "axom_mcp_discover",
                "description": "Discover available resources, structures, and capabilities",
                "domains": ["files", "tools", "memory", "capabilities", "all"],
                "parameters": {
                    "domain": {
                        "type": "string",
                        "required": True,
                        "enum": ["files", "tools", "memory", "capabilities", "all"],
                    },
                    "filter": {"type": "object", "description": "Filter criteria"},
                    "limit": {"type": "integer", "default": 100},
                    "recursive": {"type": "boolean", "default": True},
                },
            },
            {
                "name": "axom_mcp_transform",
                "description": "Transform data between formats and structures",
                "formats": ["json", "yaml", "csv", "markdown", "code"],
                "parameters": {
                    "input": {
                        "type": "string",
                        "required": True,
                        "description": "Input data to transform",
                    },
                    "input_format": {
                        "type": "string",
                        "enum": ["json", "yaml", "csv", "markdown", "code"],
                    },
                    "output_format": {
                        "type": "string",
                        "required": True,
                        "enum": ["json", "yaml", "csv", "markdown", "code"],
                    },
                    "rules": {"type": "array", "description": "Transformation rules"},
                    "template": {
                        "type": "string",
                        "description": "Template for transformation",
                    },
                },
            },
        ]
    
        return json.dumps(
            {
                "success": True,
                "domain": "tools",
                "count": len(tools),
                "results": tools,
            }
        )
  • DiscoverInput schema class defining input validation for axom_mcp_discover tool. Specifies required 'domain' field with enum values (files, tools, memory, capabilities, all), optional filter, limit (1-1000), recursive flag, and chain parameter.
    class DiscoverInput(BaseModel):
        """Input schema for axom_mcp_discover tool."""
    
        model_config = {"extra": "forbid"}
    
        domain: str = Field(
            ...,
            pattern="^(files|tools|memory|capabilities|all)$",
            description="Discovery domain",
        )
        filter: Optional[Dict[str, Any]] = Field(
            default=None, description="Filter criteria (pattern, type, etc.)"
        )
        limit: Optional[int] = Field(
            default=None, ge=1, le=1000, description="Maximum results"
        )
        recursive: Optional[bool] = Field(default=None, description="Recursive discovery")
        chain: Optional[List[Dict[str, Any]]] = Field(
            default=None, max_length=10, description="Chain operations based on discovery"
        )
  • Tool registration for axom_mcp_discover in the TOOLS list. Defines tool name, comprehensive description with discovery domains and filter options, and input schema with domain, filter, limit, recursive, and chain parameters. Dispatched via handle_discover at line 497.
        Tool(
            name="axom_mcp_discover",
            description="""Discover available resources, structures, and capabilities.
    
    Discovery Domains:
    - files: List and search files in allowed directories
    - tools: List available MCP tools and their capabilities
    - memory: Explore memory structure and statistics
    - capabilities: Check server capabilities and configuration
    - all: Comprehensive discovery across all domains
    
    Filter Options:
    - pattern: Glob pattern for file filtering (e.g., *.py)
    - type: File type filter (file, directory, all)
    - memory_type: Filter memories by type
    - importance: Filter memories by importance
    
    Chain Support:
    Use chain parameter to act on discovered resources.""",
            inputSchema={
                "type": "object",
                "properties": {
                    "domain": {
                        "type": "string",
                        "enum": ["files", "tools", "memory", "capabilities", "all"],
                        "description": "Discovery domain",
                    },
                    "filter": {"type": "object", "description": "Filter criteria"},
                    "limit": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 1000,
                        "description": "Maximum results",
                    },
                    "recursive": {"type": "boolean", "description": "Recursive discovery"},
                    "chain": {
                        "type": "array",
                        "items": {"type": "object"},
                        "description": "Chain operations based on discovery",
                    },
                },
                "required": ["domain"],
            },
            annotations=TOOL_ANNOTATIONS["discover"],
        ),
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint=true, destructiveHint=false, idempotentHint=true, and openWorldHint=false. The description adds valuable behavioral context beyond annotations: it explains what 'chain parameter' does ('act on discovered resources'), describes filtering capabilities (glob patterns, type filters), and mentions 'comprehensive discovery' for the 'all' domain. No contradiction with annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with clear sections (Discovery Domains, Filter Options, Chain Support) and uses bullet points for readability. It's appropriately sized for a multi-domain discovery tool, though the 'Filter Options' section lists options not directly mapped to schema parameters (e.g., 'importance' isn't a schema parameter), creating minor redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (5 parameters, multiple domains) and rich annotations (4 hints), the description provides good contextual completeness. It explains domains, filtering, and chaining behavior. The main gap is lack of output schema, so return values aren't described, but the discovery focus makes this less critical than for mutation tools.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all 5 parameters. The description adds some semantic context: it explains what 'domain' values mean (files=list/search, tools=list MCP tools, etc.), mentions filter options (pattern, type, memory_type, importance), and clarifies 'chain' purpose. However, it doesn't provide significant additional parameter details beyond what the schema offers.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Discover available resources, structures, and capabilities' with specific domains enumerated (files, tools, memory, capabilities, all). It distinguishes from siblings like 'analyze', 'exec', 'memory', and 'transform' by focusing on discovery rather than analysis, execution, or transformation operations.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context for when to use this tool by listing discovery domains and filter options. It doesn't explicitly state when NOT to use it or name specific alternatives among siblings, but the domain-based structure implies usage scenarios (e.g., use for 'files' discovery vs. 'memory' operations with axom_mcp_memory).

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/PugzUI/axom-mcp'

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