Skip to main content
Glama
GongRzhe

Terminal Controller for MCP

change_directory

Changes the current working directory to a specified path, enabling navigation to different directories for file operations.

Instructions

Change current working directory

Args:
    path: Directory path to switch to

Returns:
    Operation result information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes

Implementation Reference

  • The `change_directory` async function is the tool handler. It changes the current working directory using os.chdir() and returns a result message with error handling for FileNotFoundError, PermissionError, and generic exceptions. It is decorated with @mcp.tool(), which is both the handler and registration.
    @mcp.tool()
    async def change_directory(path: str) -> str:
        """
        Change current working directory
        
        Args:
            path: Directory path to switch to
        
        Returns:
            Operation result information
        """
        try:
            os.chdir(path)
            return f"Switched to directory: {os.getcwd()}"
        except FileNotFoundError:
            return f"Error: Directory '{path}' does not exist"
        except PermissionError:
            return f"Error: No permission to access directory '{path}'"
        except Exception as e:
            return f"Error changing directory: {str(e)}"
Behavior1/5

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

No annotations are provided, so the description must disclose behavioral traits. It only states the basic action without mentioning persistence, side effects, or any other behavioral aspects, which is insufficient for a mutation tool.

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 extremely concise, with no extraneous words. It front-loads the purpose and parameter in a clear format. Every sentence earns its place.

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 tool's simplicity and lack of output schema, the description omits crucial context like whether the change is persistent, impacts subsequent commands, or what errors occur. The agent needs more to use it correctly.

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 coverage is 0%, and the description adds meaning to the 'path' parameter by calling it 'Directory path to switch to'. However, it does not elaborate on format, validity, or error conditions, so it only marginally compensates for the missing schema descriptions.

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 uses a specific verb 'Change' and resource 'current working directory', clearly distinguishing it from sibling tools like get_current_directory or list_directory.

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?

No guidance on when to use this tool versus alternatives. There is no mention of prerequisites or context, leaving the agent to infer usage from the tool name alone.

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/GongRzhe/terminal-controller-mcp'

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