Skip to main content
Glama
yonaka15
by yonaka15

pyodide_list-mounted-directory

List files and directories in a mounted Pyodide filesystem to inspect accessible Python execution environments for LLMs.

Instructions

List contents of a mounted directory

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
mountNameYesName of the mount point

Implementation Reference

  • Core implementation of the tool: lists directory contents using Pyodide Python os.listdir on the mounted filesystem, categorizing files and directories.
      async listMountedDirectory(mountName: string) {
        if (!this.pyodide) {
          return formatCallToolError("Pyodide not initialized");
        }
    
        const mountConfig = this.mountPoints.get(mountName);
        if (!mountConfig) {
          return formatCallToolError(`Mount point not found: ${mountName}`);
        }
    
        try {
          // Use Python code to get directory contents
          const pythonCode = `
    import os
    
    def list_directory(path):
        contents = []
        try:
            for item in os.listdir(path):
                full_path = os.path.join(path, item)
                if os.path.isfile(full_path):
                    contents.append(f"FILE: {item}")
                elif os.path.isdir(full_path):
                    contents.append(f"DIR: {item}")
        except Exception as e:
            print(f"Error listing directory: {e}")
            return []
        return contents
    
    list_directory("${mountConfig.mountPoint}")
    `;
    
          return await this.executePython(pythonCode, 5000);
        } catch (error) {
          return formatCallToolError(error);
        }
      }
  • Tool schema definition including name, description, and input schema requiring 'mountName'.
    export const LIST_MOUNTED_DIRECTORY_TOOL: Tool = {
      name: "pyodide_list-mounted-directory",
      description: "List contents of a mounted directory",
      inputSchema: {
        type: "object",
        properties: {
          mountName: {
            type: "string",
            description: "Name of the mount point",
          },
        },
        required: ["mountName"],
      },
    };
  • Handler dispatch case: validates input using arktype and calls PyodideManager.listMountedDirectory.
    case "pyodide_list-mounted-directory": {
      const listMountedDirectoryArgs = isListMountedDirectoryArgs(args);
      if (listMountedDirectoryArgs instanceof type.errors) {
        throw listMountedDirectoryArgs;
      }
      const { mountName } = listMountedDirectoryArgs;
      const results = await pyodideManager.listMountedDirectory(mountName);
      return results;
    }
  • Registers the tool by including it in the TOOLS array returned by ListToolsRequest handler.
    const TOOLS: Tool[] = [
      tools.EXECUTE_PYTHON_TOOL,
      tools.INSTALL_PYTHON_PACKAGES_TOOL,
      tools.GET_MOUNT_POINTS_TOOL,
      tools.LIST_MOUNTED_DIRECTORY_TOOL,
      tools.READ_IMAGE_TOOL,
    ];
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. While 'List contents' implies a read-only operation, it doesn't specify what format the listing returns (e.g., file names, metadata, recursive structure), whether there are permission constraints, error conditions, or any rate limits. The description provides minimal behavioral context beyond the basic operation.

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 perfectly concise at 5 words - 'List contents of a mounted directory'. Every word earns its place, with no redundant information. It's front-loaded with the core action and resource.

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

Completeness3/5

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

For a simple read operation with 1 parameter and 100% schema coverage, the description is minimally adequate. However, with no output schema and no annotations, it should ideally provide more context about what the listing returns (e.g., file names, types, sizes) and any behavioral constraints. The description covers the basic operation but leaves important contextual gaps.

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?

The schema has 100% description coverage, with the single parameter 'mountName' clearly documented as 'Name of the mount point'. The description doesn't add any additional parameter semantics beyond what the schema already provides, so it meets the baseline score of 3 for high schema 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 as 'List contents of a mounted directory' - a specific verb ('List') and resource ('contents of a mounted directory'). It distinguishes from siblings like 'pyodide_execute' (execution) and 'pyodide_read-image' (reading specific files), though it doesn't explicitly differentiate from 'pyodide_get-mount-points' which lists mounts rather than directory contents.

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. It doesn't mention prerequisites (like needing a mounted directory first), when not to use it, or how it relates to sibling tools like 'pyodide_get-mount-points' (which lists mount points rather than directory contents).

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/yonaka15/mcp-pyodide'

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