Skip to main content
Glama
bswa006
by bswa006

initialize_agent_workspace

Set up an AI agent workspace by generating template files and configuring project context based on specified project path, name, and optional tech stack.

Instructions

Initialize AI agent workspace with template files and context

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectNameYesName of the project
projectPathYesPath to the project directory
techStackNoOptional tech stack configuration

Implementation Reference

  • Main handler function that initializes the agent workspace by creating template files (AGENT-CODING-TEMPLATE.md, AGENT-CONTEXT.md, etc.), customizing them based on config, and returning configuration paths and next steps.
    export async function initializeAgentWorkspace( config: WorkspaceConfig ): Promise<InitializationResult> { const result: InitializationResult = { success: false, filesCreated: [], configuration: { templatePath: '', contextPath: '', memoryPath: '', context7Path: '', }, nextSteps: [], message: '', }; try { // Ensure project directory exists if (!existsSync(config.projectPath)) { mkdirSync(config.projectPath, { recursive: true }); } // Define file paths const templatePath = join(config.projectPath, 'AGENT-CODING-TEMPLATE.md'); const contextPath = join(config.projectPath, 'AGENT-CONTEXT.md'); const memoryPath = join(config.projectPath, 'AGENT-MEMORY.md'); const context7Path = join(config.projectPath, '.context7.yaml'); const codebaseContextPath = join(config.projectPath, 'CODEBASE-CONTEXT.md'); // Copy and customize AGENT-CODING-TEMPLATE.md if (!existsSync(templatePath)) { const templateContent = readFileSync( join(__dirname, '../../../AGENT-CODING-TEMPLATE.md'), 'utf-8' ); const customizedTemplate = customizeTemplate(templateContent, config); writeFileSync(templatePath, customizedTemplate); result.filesCreated.push('AGENT-CODING-TEMPLATE.md'); } // Copy and customize AGENT-CONTEXT.md if (!existsSync(contextPath)) { const contextContent = readFileSync( join(__dirname, '../../../AGENT-CONTEXT.md'), 'utf-8' ); const customizedContext = initializeContext(contextContent, config); writeFileSync(contextPath, customizedContext); result.filesCreated.push('AGENT-CONTEXT.md'); } // Copy AGENT-MEMORY.md if (!existsSync(memoryPath)) { const memoryContent = readFileSync( join(__dirname, '../../../AGENT-MEMORY.md'), 'utf-8' ); writeFileSync(memoryPath, memoryContent); result.filesCreated.push('AGENT-MEMORY.md'); } // Copy and customize .context7.yaml if (!existsSync(context7Path)) { const context7Content = readFileSync( join(__dirname, '../../../.context7.yaml'), 'utf-8' ); const customizedContext7 = customizeContext7(context7Content, config); writeFileSync(context7Path, customizedContext7); result.filesCreated.push('.context7.yaml'); } // Create initial CODEBASE-CONTEXT.md if it doesn't exist if (!existsSync(codebaseContextPath)) { const codebaseContext = generateInitialCodebaseContext(config); writeFileSync(codebaseContextPath, codebaseContext); result.filesCreated.push('CODEBASE-CONTEXT.md'); } // Set configuration paths result.configuration = { templatePath, contextPath, memoryPath, context7Path, }; // Define next steps result.nextSteps = [ '1. Review AGENT-CODING-TEMPLATE.md for your mission briefing', '2. Check CODEBASE-CONTEXT.md and customize for your project', '3. Update .context7.yaml with your specific library versions', '4. Start development with pre-flight checklist from template', '5. Use tracking tools to monitor performance', ]; result.success = true; result.message = `Workspace initialized successfully for ${config.projectName}. Agent memory system is now active!`; } catch (error) { result.success = false; result.message = `Failed to initialize workspace: ${error}`; } return result; }
  • MCP tool definition including input schema for validating tool parameters: projectPath, projectName, and optional techStack.
    { name: 'initialize_agent_workspace', description: 'Initialize AI agent workspace with template files and context', inputSchema: { type: 'object', properties: { projectPath: { type: 'string', description: 'Path to the project directory', }, projectName: { type: 'string', description: 'Name of the project', }, techStack: { type: 'object', properties: { language: { type: 'string' }, framework: { type: 'string' }, uiLibrary: { type: 'string' }, testFramework: { type: 'string' }, }, description: 'Optional tech stack configuration', }, }, required: ['projectPath', 'projectName'], }, },
  • Tool registration in the main switch statement within CallToolRequestSchema handler, including Zod validation and call to the handler function.
    case 'initialize_agent_workspace': { const params = z.object({ projectPath: z.string(), projectName: z.string(), techStack: z.object({ language: z.string().optional(), framework: z.string().optional(), uiLibrary: z.string().optional(), testFramework: z.string().optional(), }).optional(), }).parse(args); const result = await initializeAgentWorkspace(params); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; }
  • TypeScript interfaces defining input (WorkspaceConfig) and output (InitializationResult) structures used by the handler.
    interface WorkspaceConfig { projectPath: string; projectName: string; techStack?: { language?: string; framework?: string; uiLibrary?: string; testFramework?: string; }; } interface InitializationResult { success: boolean; filesCreated: string[]; configuration: { templatePath: string; contextPath: string; memoryPath: string; context7Path: string; }; nextSteps: string[]; message: string; }

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/bswa006/mcp-context-manager'

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