Skip to main content
Glama
PWalaGov

Enhanced Directory Context MCP Server

by PWalaGov

set_working_directory

Specify a directory path to establish the active working location for context extraction and analysis operations.

Instructions

Set the working directory for context extraction

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
directoryYesPath to the directory to analyze

Implementation Reference

  • The handler function for 'set_working_directory' that validates the directory path, updates the server's working directory, and returns a confirmation message.
    async setWorkingDirectory(directory) { try { const resolvedPath = path.resolve(directory); const stats = await fs.stat(resolvedPath); if (!stats.isDirectory()) { throw new Error('Path is not a directory'); } this.workingDirectory = resolvedPath; return { content: [ { type: 'text', text: `Working directory set to: ${this.workingDirectory}`, }, ], }; } catch (error) { throw new McpError(ErrorCode.InvalidParams, `Invalid directory: ${error.message}`); } }
  • Input schema definition for the 'set_working_directory' tool, specifying a required 'directory' string parameter.
    inputSchema: { type: 'object', properties: { directory: { type: 'string', description: 'Path to the directory to analyze', }, }, required: ['directory'], },
  • server.js:52-64 (registration)
    Tool registration entry in the listTools response, including name, description, and input schema.
    name: 'set_working_directory', description: 'Set the working directory for context extraction', inputSchema: { type: 'object', properties: { directory: { type: 'string', description: 'Path to the directory to analyze', }, }, required: ['directory'], }, },
  • Dispatch case in the main CallToolRequestSchema handler that invokes the setWorkingDirectory method.
    case 'set_working_directory': return await this.setWorkingDirectory(args.directory);

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/PWalaGov/File-Control-MCP'

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