Skip to main content
Glama
theburgerllc

AI Development Pipeline MCP

by theburgerllc

write_project_file

Write content to local files within the VS Code workspace directory to manage project files and code during AI-assisted development.

Instructions

Write to a local file in the VS Code workspace (restricted to workspace directory)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes
contentYes

Implementation Reference

  • Handler function that validates the file path using validatePath helper and writes the provided content to the file using fs.writeFileSync, returning success or error message.
    async ({ path, content }) => { try { const safePath = validatePath(path); fs.writeFileSync(safePath, content, 'utf8'); return { content: [{ type: 'text', text: `File written: ${path}` }] }; } catch (err: any) { return { content: [{ type: 'text', text: `File write error: ${err.message}` }] }; } }
  • Input schema using Zod: requires 'path' (string) for the file location and 'content' (string) for the file contents.
    { path: z.string(), content: z.string() },
  • Registers the 'write_project_file' tool on the MCP server with name, description, input schema, and handler function.
    server.tool( 'write_project_file', 'Write to a local file in the VS Code workspace (restricted to workspace directory)', { path: z.string(), content: z.string() }, async ({ path, content }) => { try { const safePath = validatePath(path); fs.writeFileSync(safePath, content, 'utf8'); return { content: [{ type: 'text', text: `File written: ${path}` }] }; } catch (err: any) { return { content: [{ type: 'text', text: `File write error: ${err.message}` }] }; } } );
  • Security helper that resolves and validates the file path to ensure it stays within the workspace root, preventing path traversal attacks.
    function validatePath(filePath: string): string { const resolvedPath = path.resolve(WORKSPACE_ROOT, filePath); if (!resolvedPath.startsWith(WORKSPACE_ROOT)) { throw new Error('Path traversal detected - access denied'); } return resolvedPath; }

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/theburgerllc/ai-development-pipeline-mcp'

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