Skip to main content
Glama
theburgerllc

AI Development Pipeline MCP

by theburgerllc

check_file_exists

Verify the existence of a file within the workspace directory to ensure availability for AI development workflows in the AI Development Pipeline MCP.

Instructions

Check if a local file exists (restricted to workspace directory)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes

Implementation Reference

  • Handler function that validates the input path using validatePath helper and checks file existence with fs.existsSync, returning appropriate text response.
    async ({ path }) => { try { const safePath = validatePath(path); const exists = fs.existsSync(safePath); return { content: [{ type: 'text', text: exists ? 'File exists' : 'File does not exist' }] }; } catch (err: any) { return { content: [{ type: 'text', text: `File check error: ${err.message}` }] }; } }
  • Registration of the check_file_exists MCP tool with server.tool, specifying name, description, input schema, and inline handler function.
    server.tool( 'check_file_exists', 'Check if a local file exists (restricted to workspace directory)', { path: z.string() }, async ({ path }) => { try { const safePath = validatePath(path); const exists = fs.existsSync(safePath); return { content: [{ type: 'text', text: exists ? 'File exists' : 'File does not exist' }] }; } catch (err: any) { return { content: [{ type: 'text', text: `File check error: ${err.message}` }] }; } } );
  • Zod schema for tool input: requires a 'path' string parameter.
    { path: z.string() },
  • Security helper function validatePath that resolves the file path relative to WORKSPACE_ROOT and prevents 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; }

Other Tools

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

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