Skip to main content
Glama

create_directory

Create a new directory at a specified path to organize files within a development workspace.

Instructions

Create a new directory

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesPath for the new directory

Implementation Reference

  • The createDirectory method in FileService that creates a new directory. It resolves the path, checks if the directory already exists (returns error if so), creates it with fs.mkdir({ recursive: true }), and returns a success or error ToolResult.
    async createDirectory(dirPath: string): Promise<ToolResult> {
      try {
        const fullPath = this.workspaceService.resolvePath(dirPath);
        
        // Check if directory already exists
        try {
          const stats = await fs.stat(fullPath);
          if (stats.isDirectory()) {
            return {
              isError: true,
              content: [{
                type: 'text',
                text: `Directory already exists: ${fullPath}`
              }]
            };
          }
        } catch {
          // Directory doesn't exist, which is what we want
        }
        
        await fs.mkdir(fullPath, { recursive: true });
        
        return {
          content: [{
            type: 'text',
            text: `Directory successfully created: ${fullPath}`,
          }],
        };
      } catch (error: any) {
        return {
          isError: true,
          content: [{
            type: 'text',
            text: error.message || 'Failed to create directory'
          }]
        };
      }
    }
  • The input schema definition for the 'create_directory' tool. Defines a 'path' string property as required input and provides the description 'Create a new directory'.
    {
      name: 'create_directory',
      description: 'Create a new directory',
      inputSchema: {
        type: 'object',
        properties: {
          path: { type: 'string', description: 'Path for the new directory' },
        },
        required: ['path'],
      },
    },
  • The routing in executeToolCommand where the 'create_directory' case dispatches to this.fileService.createDirectory(args.path).
    case 'create_directory':
      return await this.fileService.createDirectory(args.path);
  • src/index.ts:112-114 (registration)
    Tool registration using ListToolsRequestSchema - this server's setRequestHandler returns TOOL_DEFINITIONS which includes the create_directory definition.
    this.server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools: TOOL_DEFINITIONS,
    }));
  • Mock createDirectory function used in tests for the FileService mock.
    createDirectory: jest.fn()
Behavior1/5

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

No annotations provided, and description fails to disclose behavioral traits such as side effects (e.g., what if directory exists), permissions, return value, or error conditions.

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

Conciseness2/5

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

Extremely brief (one sentence) but under-specifies essential information. Conciseness at the expense of completeness is not beneficial.

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

Completeness1/5

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

Utterly incomplete for a simple tool. Lacks any context about behavior (e.g., overwrite vs fail), return value, or error handling. Output schema absent.

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 covers 100% of parameters with description 'Path for the new directory'. Description adds no additional meaning beyond schema, so baseline score of 3 applies.

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

Purpose3/5

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

Description states verb+resource (Create a new directory) but is a tautology of the tool name and lacks differentiation from sibling tools like delete_file or move_file. It provides no context on scope or location.

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. Does not mention prerequisites, when not to use, or related 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/agentics-ai/code-mcp'

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