Skip to main content
Glama

aidex_describe

Documents project details by adding or updating sections in summary.md for purpose, architecture, concepts, patterns, or notes.

Instructions

Add or update a section in the project summary (summary.md). Use to document project purpose, architecture, key concepts, or patterns.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesPath to project with .aidex directory
sectionYesSection to update
contentYesContent to add to the section
replaceNoReplace existing section content (default: append)

Implementation Reference

  • Tool registration and input schema definition for aidex_describe. Defines the tool name, description, and input parameters (path, section, content, replace).
    { name: `${TOOL_PREFIX}describe`, description: 'Add or update a section in the project summary (summary.md). Use to document project purpose, architecture, key concepts, or patterns.', inputSchema: { type: 'object', properties: { path: { type: 'string', description: `Path to project with ${INDEX_DIR} directory`, }, section: { type: 'string', enum: ['purpose', 'architecture', 'concepts', 'patterns', 'notes'], description: 'Section to update', }, content: { type: 'string', description: 'Content to add to the section', }, replace: { type: 'boolean', description: 'Replace existing section content (default: append)', }, }, required: ['path', 'section', 'content'], }, },
  • Tool handler routing - maps the aidex_describe tool name to the handleDescribe function.
    case `${TOOL_PREFIX}describe`: return handleDescribe(args);
  • MCP tool handler for aidex_describe. Validates parameters, calls the describe command, and formats the response for the MCP client.
    /** * Handle describe */ function handleDescribe(args: Record<string, unknown>): { content: Array<{ type: string; text: string }> } { const path = args.path as string; const section = args.section as string; const content = args.content as string; if (!path || !section || !content) { return { content: [{ type: 'text', text: 'Error: path, section, and content parameters are required' }], }; } const validSections = ['purpose', 'architecture', 'concepts', 'patterns', 'notes']; if (!validSections.includes(section)) { return { content: [{ type: 'text', text: `Error: section must be one of: ${validSections.join(', ')}` }], }; } const result = describe({ path, section: section as 'purpose' | 'architecture' | 'concepts' | 'patterns' | 'notes', content, replace: args.replace as boolean | undefined, }); if (!result.success) { return { content: [{ type: 'text', text: `Error: ${result.error}` }], }; } return { content: [{ type: 'text', text: `✓ Updated section: ${result.section}` }], }; }
  • Type definitions for the describe command - DescribeParams and DescribeResult interfaces defining the input/output contract.
    export interface DescribeParams { path: string; section: 'purpose' | 'architecture' | 'concepts' | 'patterns' | 'notes'; content: string; replace?: boolean; // Replace existing section? Default: append } export interface DescribeResult { success: boolean; section: string; error?: string; }
  • Core implementation of the describe command. Reads/writes summary.md file, manages sections (purpose, architecture, concepts, patterns, notes), handles append vs replace modes.
    export function describe(params: DescribeParams): DescribeResult { const { path: projectPath, section, content, replace = false } = params; // Validate project path const indexDir = join(projectPath, INDEX_DIR); const dbPath = join(indexDir, 'index.db'); if (!existsSync(dbPath)) { return { success: false, section, error: `No ${PRODUCT_NAME} index found at ${projectPath}. Run ${TOOL_PREFIX}init first.`, }; } const summaryPath = join(indexDir, 'summary.md'); try { // Read existing summary or create new let summaryContent = ''; if (existsSync(summaryPath)) { summaryContent = readFileSync(summaryPath, 'utf-8'); } // Section headers const sectionHeaders: Record<string, string> = { purpose: '## Purpose', architecture: '## Architecture', concepts: '## Key Concepts', patterns: '## Patterns', notes: '## Notes', }; const header = sectionHeaders[section]; const sectionRegex = new RegExp(`^${header}\\n([\\s\\S]*?)(?=^## |$)`, 'm'); if (replace) { // Replace entire section if (sectionRegex.test(summaryContent)) { summaryContent = summaryContent.replace(sectionRegex, `${header}\n${content}\n\n`); } else { // Add new section at end summaryContent = summaryContent.trimEnd() + `\n\n${header}\n${content}\n`; } } else { // Append to section const match = summaryContent.match(sectionRegex); if (match) { const existingContent = match[1].trimEnd(); const newContent = existingContent ? `${existingContent}\n${content}` : content; summaryContent = summaryContent.replace(sectionRegex, `${header}\n${newContent}\n\n`); } else { // Add new section at end summaryContent = summaryContent.trimEnd() + `\n\n${header}\n${content}\n`; } } // Write back writeFileSync(summaryPath, summaryContent.trimStart()); return { success: true, section, }; } catch (err) { return { success: false, section, error: err instanceof Error ? err.message : String(err), }; } }

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/CSCSoftware/AiDex'

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