Skip to main content
Glama
bswa006

AI Agent Template MCP Server

by bswa006

create_conversation_starters

Generate conversation starters to help AI agents understand project context quickly by analyzing codebases and including relevant tasks.

Instructions

Create conversation starters to help AI understand project context quickly

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectPathYesPath to the project directory
analysisIdNoAnalysis ID from analyze_codebase_deeply
includeQuickTasksNoInclude common quick tasks section
includeCurrentWorkNoInclude recent git commits
tokenLimitNoMaximum tokens for the file
customTasksNoCustom quick tasks to include

Implementation Reference

  • Main handler function that executes the tool logic: generates and writes conversation starters file based on codebase analysis, recent work, and configuration.
    export async function createConversationStarters(
      config: ConversationStarterConfig
    ): Promise<ConversationStarterResult> {
      const result: ConversationStarterResult = {
        success: false,
        filePath: '',
        message: '',
        tokenCount: 0,
        filesCreated: [],
      };
    
      try {
        // Check if analysis has been completed
        const analysisId = config.analysisId || global.latestAnalysisId;
        if (!analysisId || !global.codebaseAnalysis?.[analysisId]) {
          throw new Error('Codebase analysis must be completed first. Run analyze_codebase_deeply tool.');
        }
    
        const analysis: DeepAnalysisResult = global.codebaseAnalysis[analysisId];
        
        // Check for existing git history to find recent work
        const recentWork = await getRecentWork(config.projectPath);
        
        // Generate conversation starters based on analysis and config
        const starters = generateConversationStarters(analysis, config, recentWork);
        
        // Estimate token count
        result.tokenCount = Math.ceil(starters.length / 4);
        
        // Apply token limit if specified
        let finalContent = starters;
        if (config.tokenLimit && result.tokenCount > config.tokenLimit) {
          finalContent = trimToTokenLimit(starters, config.tokenLimit);
          result.tokenCount = config.tokenLimit;
        }
        
        // Write to file
        const filePath = join(config.projectPath, 'agent-context', 'conversation-starters.md');
        writeFileSync(filePath, finalContent);
        
        result.success = true;
        result.filePath = filePath;
        result.filesCreated = [filePath];
        result.message = `Created conversation-starters.md (${result.tokenCount} tokens) with project context and ${config.includeQuickTasks ? 'quick tasks' : 'overview only'}`;
      } catch (error) {
        result.success = false;
        result.message = `Failed to create conversation starters: ${error}`;
      }
    
      return result;
    }
  • Tool registration and execution handler in the main switch statement, including input validation schema and call to the handler function.
    case 'create_conversation_starters': {
      const params = z.object({
        projectPath: z.string(),
        analysisId: z.string().optional(),
        includeQuickTasks: z.boolean().optional(),
        includeCurrentWork: z.boolean().optional(),
        tokenLimit: z.number().optional(),
        customTasks: z.array(z.string()).optional(),
      }).parse(args);
      
      const result = await createConversationStarters(params);
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
    }
  • Tool schema definition including name, description, and inputSchema for validation in the tool list.
    {
      name: 'create_conversation_starters',
      description: 'Create conversation starters to help AI understand project context quickly',
      inputSchema: {
        type: 'object',
        properties: {
          projectPath: {
            type: 'string',
            description: 'Path to the project directory',
          },
          analysisId: {
            type: 'string',
            description: 'Analysis ID from analyze_codebase_deeply',
          },
          includeQuickTasks: {
            type: 'boolean',
            description: 'Include common quick tasks section',
          },
          includeCurrentWork: {
            type: 'boolean',
            description: 'Include recent git commits',
          },
          tokenLimit: {
            type: 'number',
            description: 'Maximum tokens for the file',
          },
          customTasks: {
            type: 'array',
            items: { type: 'string' },
            description: 'Custom quick tasks to include',
          },
        },
        required: ['projectPath'],
      },
    },
  • Import statement registering the handler function for use in the tool execution switch.
    import { createConversationStarters } from './workspace/create-conversation-starters.js';
  • Helper function that generates the actual conversation starters content from the analysis data.
    function generateConversationStarters(
      analysis: DeepAnalysisResult,
      config: ConversationStarterConfig,
      recentWork: string[]
    ): string {
      const { summary, patterns, structure, recommendations } = analysis;
      const projectName = analysis.projectPath.split('/').pop() || 'Project';
      
      let content = `# 🚀 AI Context Loading Instructions
    
    ## Quick Start (Copy & Paste)
    \`\`\`
    I'm working on ${projectName}, a ${summary.frameworks.join(' + ')} application. 
    Please load and review these context files in order:
    1. agent-context/CODEBASE-CONTEXT.md - patterns and conventions
    2. agent-context/PROJECT-TEMPLATE.md - architecture overview
    3. agent-context/.context7.yaml - API verification
    \`\`\`
    
    ## Project Overview
    - **Tech Stack**: ${summary.techStack.join(', ')}
    - **Total Files**: ${summary.totalFiles}
    - **Primary Language**: ${summary.primaryLanguage}
    - **Testing**: ${summary.testingFrameworks.join(', ') || 'Not configured'}
    
    ## Key Patterns to Follow
    - **Components**: ${patterns.components.style} with ${patterns.components.propsPattern}
    - **State**: ${patterns.stateManagement.join(', ') || 'Local state only'}
    - **Styling**: ${patterns.styling}
    - **Imports**: ${patterns.imports.style} style preferred
    
    ## Project Structure
    ${Object.entries(structure.directories)
      .filter(([_, info]: [string, any]) => info.fileCount > 5)
      .slice(0, 6)
      .map(([path, info]: [string, any]) => `- **${path}**: ${info.purpose}`)
      .join('\n')}
    `;
    
      // Add recent work section if requested and available
      if (config.includeCurrentWork && recentWork.length > 0) {
        content += `\n## Recent Work (Last 7 days)
    ${recentWork.slice(0, 5).map(commit => `- ${commit}`).join('\n')}
    `;
      }
    
      // Add quick tasks section if requested
      if (config.includeQuickTasks) {
        content += `\n## Common Quick Tasks
    ${generateQuickTasks(analysis, config.customTasks)}
    `;
      }
    
      // Add recommendations if any
      if (recommendations.length > 0) {
        content += `\n## Important Recommendations
    ${recommendations.slice(0, 3).map(rec => `- ${rec}`).join('\n')}
    `;
      }
    
      // Add token optimization tip
      content += `\n## Token Optimization
    - For simple tasks: Load only CODEBASE-CONTEXT.md
    - For new features: Load PROJECT-TEMPLATE.md + CODEBASE-CONTEXT.md
    - For debugging: Add .context7.yaml for import verification
    - For architecture: Load all three files
    
    ## Starting a Task
    After loading context, you can say:
    - "Create a new component called..."
    - "Add a feature that..."
    - "Fix the issue with..."
    - "Refactor the..."
    - "Add tests for..."
    `;
    
      // Add evidence files section
      if (analysis.evidenceFiles.length > 0) {
        content += `\n## Example Files to Reference
    ${analysis.evidenceFiles.slice(0, 5).map(ef => `- ${ef.path}: ${ef.purpose}`).join('\n')}
    `;
      }
    
      return content;
    }
    
    function generateQuickTasks(analysis: DeepAnalysisResult, customTasks?: string[]): string {
      const defaultTasks = [
        `Create a new ${analysis.patterns.components.style} component with TypeScript`,
        `Add a new API endpoint following existing patterns`,
        `Write tests for a component using ${analysis.summary.testingFrameworks[0] || 'Jest'}`,
        `Add error handling to an existing feature`,
        `Implement a new hook following the use* pattern`,
      ];
      
      const tasks = customTasks && customTasks.length > 0 ? customTasks : defaultTasks;
      
      return tasks.map((task, i) => `${i + 1}. ${task}`).join('\n');
    }
    
    async function getRecentWork(projectPath: string): Promise<string[]> {
      try {
        // Check if it's a git repository
        const gitPath = join(projectPath, '.git');
        if (!existsSync(gitPath)) {
          return [];
        }
        
        // Get recent commits (this is a simplified version)
        // In a real implementation, you'd use git commands or a git library
        const { execSync } = await import('child_process');
        const recentCommits = execSync(
          'git log --oneline --since="7 days ago" --max-count=10',
          { cwd: projectPath, encoding: 'utf-8' }
        ).trim().split('\n').filter(Boolean);
        
        return recentCommits;
      } catch (error) {
        // If git commands fail, return empty array
        return [];
      }
    }
    
    function trimToTokenLimit(content: string, tokenLimit: number): string {
      // Simple token estimation: 1 token ≈ 4 characters
      const charLimit = tokenLimit * 4;
      
      if (content.length <= charLimit) {
        return content;
      }
      
      // Trim content intelligently by sections
      const sections = content.split('\n## ');
      let trimmedContent = sections[0]; // Keep the header
      let currentLength = trimmedContent.length;
      
      // Add sections until we hit the limit
      for (let i = 1; i < sections.length; i++) {
        const section = '\n## ' + sections[i];
        if (currentLength + section.length > charLimit) {
          // Add a truncation notice
          trimmedContent += '\n\n*[Content trimmed to fit token limit]*';
          break;
        }
        trimmedContent += section;
        currentLength += section.length;
      }
      
      return trimmedContent;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states what the tool creates but doesn't describe how it behaves: whether it modifies files, requires specific permissions, has rate limits, what format the output takes, or any side effects. 'Create' implies a write operation, but no safety or behavioral details are provided.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that states the core purpose without unnecessary words. It's appropriately sized for a tool with good schema documentation and gets straight to the point with zero wasted text.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 6 parameters, no annotations, and no output schema, the description is insufficient. It doesn't explain what conversation starters look like, how they're delivered, what format they take, or any behavioral constraints. The schema handles parameters well, but the overall context for using this creation tool is incomplete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents all 6 parameters. The description adds no parameter-specific information beyond what's in the schema. The baseline is 3 when schema coverage is high, even without additional param details in the description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'create' and the resource 'conversation starters', with the purpose 'to help AI understand project context quickly'. It distinguishes from siblings by focusing on conversation generation rather than analysis, testing, or configuration tasks. However, it doesn't explicitly differentiate from similar tools like 'initialize_agent_workspace' or 'get_pattern_for_task'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It mentions the purpose but doesn't specify prerequisites (like requiring analysisId from analyze_codebase_deeply), appropriate contexts, or when other tools might be better suited. The sibling list includes many context-related tools without differentiation.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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

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