Skip to main content
Glama
PWalaGov

Enhanced Directory Context MCP Server

by PWalaGov

set_working_directory

Define the active directory for context extraction, enabling targeted analysis and file management within the specified path for streamlined project 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 that resolves the directory path, validates it is a directory, sets this.workingDirectory, and returns a success 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}`); } }
  • server.js:52-64 (registration)
    Tool registration in the ListToolsRequestSchema handler, 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'], }, },
  • server.js:454-455 (registration)
    Dispatch/registration in the CallToolRequestSchema switch statement that routes to the handler.
    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