Skip to main content
Glama
JeremyLakeyJr

Friday MCP Server

list_workspace

List files and directories in the configured workspace root. Specify a path to explore subdirectories and set max depth to limit recursion.

Instructions

List files and directories under the configured workspace root.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathNo.
max_depthNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The actual handler function for the 'list_workspace' tool. It uses a closure-based registration pattern with @mcp.tool() decorator. Lists files/directories under the workspace root with configurable max_depth, using _resolve_path to validate the path is within the workspace.
    def list_workspace(path: str = ".", max_depth: int = 2) -> list[str]:
        """List files and directories under the configured workspace root."""
        root = _resolve_path(path)
        entries: list[str] = []
        max_depth = max(0, max_depth)
        base_depth = len(root.parts)
    
        for item in sorted(root.rglob("*")):
            depth = len(item.parts) - base_depth
            if depth > max_depth:
                continue
            entries.append(str(item.relative_to(config.workspace_root)))
    
        if root.is_dir():
            entries.insert(0, str(root.relative_to(config.workspace_root)))
        return entries
  • Registers the workspace module (including list_workspace) by calling workspace.register(mcp, config=config).
    workspace.register(mcp, config=config)
    skills.register(mcp, skill_store=skill_store)
  • The function signature serves as the schema: 'path: str = "."' and 'max_depth: int = 2' are input parameters; the return type is 'list[str]'.
    def list_workspace(path: str = ".", max_depth: int = 2) -> list[str]:
  • _resolve_path helper function used by list_workspace to resolve and validate that the given path is within the workspace root (or allowed via allow_external_paths).
    def _resolve_path(path: str) -> Path:
        raw_path = Path(path).expanduser()
        resolved = (
            raw_path.resolve()
            if raw_path.is_absolute()
            else (config.workspace_root / raw_path).resolve()
        )
        if config.allow_external_paths:
            return resolved
        if resolved != config.workspace_root and config.workspace_root not in resolved.parents:
            raise ValueError(
                f"Path '{path}' is outside the workspace root {config.workspace_root}."
            )
        return resolved
Behavior2/5

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

No annotations provided, and the description only states the basic action. It does not disclose behavior like symlink handling, permissions, or performance. With no annotations, the description carries full burden but is insufficient.

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 concise sentence, front-loaded with the key action. Every word is necessary.

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?

Despite an output schema, the description lacks context about scope (e.g., workspace root boundaries) and parameter semantics. Given low schema coverage and no annotations, the description is too minimal to be fully complete.

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

Parameters1/5

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

Input schema has 0% description coverage, and the description adds no information about the 'path' or 'max_depth' parameters. It does not explain default values or behavior, failing to compensate for low schema coverage.

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 lists files and directories under the configured workspace root. It uses a specific verb-resource combination and differentiates from siblings like read_file.

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

Usage Guidelines3/5

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

No guidance on when to use this tool vs alternatives. The description implies usage for listing workspace contents but lacks exclusions or context about when to use other tools.

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/JeremyLakeyJr/mcp-server'

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