Skip to main content
Glama

find

Search for files by pattern within virtual filesystem workspaces, supporting multiple storage providers and scopes.

Instructions

Find files matching a pattern.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
requestYes

Implementation Reference

  • The core handler function that implements the find tool logic, recursively searching directories for files matching the given pattern using fnmatch.
    async def find(self, request: FindRequest) -> FindResponse:
        """
        Find files matching a pattern.
    
        Args:
            request: FindRequest with pattern, path, and max_results
    
        Returns:
            FindResponse with matching paths
        """
        vfs = self.workspace_manager.get_current_vfs()
        resolved_path = self.workspace_manager.resolve_path(request.path)
    
        results: list[str] = []
        truncated = False
    
        async def search(current_path: str) -> None:
            nonlocal truncated
            if len(results) >= request.max_results:
                truncated = True
                return
    
            filenames = await vfs.ls(current_path)
            for name in filenames:
                if len(results) >= request.max_results:
                    truncated = True
                    break
    
                # Construct full path
                if current_path == "/":
                    full_path = f"/{name}"
                else:
                    full_path = f"{current_path}/{name}"
    
                # Check if name matches pattern
                if fnmatch(name, request.pattern):
                    results.append(full_path)
    
                # Recurse into directories
                node_info = await vfs.get_node_info(full_path)
                if node_info and node_info.is_dir:
                    await search(full_path)
    
        await search(resolved_path)
        return FindResponse(
            pattern=request.pattern, matches=results, truncated=truncated
        )
  • Registration of the 'find' tool using the @server.tool decorator, which delegates execution to the VFSTools.find method.
    @server.tool
    async def find(request: FindRequest):
        """Find files matching a pattern."""
        return await vfs_tools.find(request)
  • Pydantic models defining the input schema (FindRequest with pattern, path, max_results) and output schema (FindResponse with matches and truncation status) for the find tool.
    class FindRequest(BaseModel):
        """Request to find files"""
    
        pattern: str
        path: str = "."
        max_results: int = Field(default=100, ge=1, le=1000)
    
    
    class FindResponse(BaseModel):
        """Response from find operation"""
    
        pattern: str
        matches: list[str]
        truncated: bool = False
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions 'matching a pattern' but doesn't specify whether this is a read-only operation, what permissions are needed, how results are returned (e.g., list format, pagination), or any error conditions. For a tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.

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

Conciseness5/5

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

The description is a single, efficient sentence with no wasted words, making it easy to parse and front-loaded with the core purpose. It achieves maximum clarity per word count.

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

Completeness2/5

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

Given the lack of annotations, no output schema, and low schema description coverage, the description is incomplete. It doesn't explain return values, error handling, or behavioral nuances, making it inadequate for a tool that likely interacts with a file system and has many sibling alternatives.

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

Parameters2/5

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

The input schema has 1 parameter with 0% description coverage, and the description only vaguely implies the parameter is for a 'pattern' without detailing syntax, format, or examples. It adds minimal meaning beyond the schema, insufficiently compensating for the low coverage.

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

Purpose4/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 with a specific verb ('find') and resource ('files'), and indicates the action is based on a pattern. However, it doesn't explicitly differentiate from sibling tools like 'grep' or 'ls' that might also search or list files, leaving some ambiguity about its unique role.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives like 'grep' or 'ls', nor does it mention any prerequisites or exclusions. It only states what the tool does, without contextual usage information.

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/IBM/chuk-mcp-vfs'

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