Skip to main content
Glama
vltansky

Cursor Conversations MCP Server

get_conversation_analytics

Analyze Cursor chat history to identify coding patterns, file usage, and development activity trends for improved project insights.

Instructions

Get comprehensive analytics and statistics about Cursor chats including usage patterns, file activity, programming language distribution, and temporal trends. BEST PRACTICE: Use projectPath parameter for project-specific analytics - this analyzes only conversations that worked on files in that project, providing much more relevant insights for understanding coding patterns, file usage, and development activity within a specific codebase. WORKFLOW TIP: Always include "files" and "languages" in breakdowns - these contain conversation IDs in their arrays that you can immediately use with get_conversation tool. Use includeConversationDetails=true when you need the full conversation ID list and basic metadata for follow-up analysis.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
scopeNoAnalysis scope: all conversations, recent only, or project-specific. Use "project" with projectPath for focused project analysis.all
projectPathNo**HIGHLY RECOMMENDED** Project/codebase name (e.g., "my-app") or full path for project-scoped analysis. When provided, analyzes only conversations that worked on files in that project, giving much more relevant insights about coding patterns and development activity.
recentDaysNoNumber of recent days to analyze (1-365)
includeBreakdownsNoTypes of breakdowns to include in the analysis. IMPORTANT: "files" and "languages" breakdowns contain conversation IDs in their arrays - use these for follow-up analysis!
includeConversationDetailsNoInclude full conversation ID list and basic metadata (increases response size significantly)
outputModeNoOutput format: "json" for formatted JSON (default), "compact-json" for minified JSONjson

Implementation Reference

  • The main handler function that executes the get_conversation_analytics tool logic, querying the database, calculating analytics breakdowns, and returning structured ConversationAnalytics.
    export async function getConversationAnalytics(
      input: GetConversationAnalyticsInput
    ): Promise<ConversationAnalytics> {
      const reader = new CursorDatabaseReader();
    
      try {
        await reader.connect();
    
        // Build filters based on scope
        const filters: ConversationFilters = {
          format: 'both',
          minLength: 100 // Filter out only very small conversations (reduced from 1000)
        };
    
        if (input.scope === 'project' && input.projectPath) {
          filters.projectPath = input.projectPath;
        }
    
        // Get conversation IDs
        const conversationIds = await reader.getConversationIds(filters);
    
        // Apply recent filter if needed
        let filteredIds = conversationIds;
        if (input.scope === 'recent') {
          // Take the most recent conversations (ROWID ordering)
          const recentCount = Math.min(conversationIds.length, Math.floor(conversationIds.length * 0.3));
          filteredIds = conversationIds.slice(0, recentCount);
        }
    
        // Get conversation summaries
        const summaries = await reader.getConversationSummariesForAnalytics(filteredIds);
    
        // Calculate overview
        const overview = calculateOverview(summaries);
    
        // Calculate breakdowns
        const breakdowns: any = {};
    
        if (input.includeBreakdowns.includes('files')) {
          breakdowns.files = calculateFileBreakdown(summaries);
        }
    
        if (input.includeBreakdowns.includes('languages')) {
          // Get conversations with code blocks for language analysis
          const conversationsWithCode = await reader.getConversationsWithCodeBlocks(filteredIds);
          breakdowns.languages = calculateLanguageBreakdown(conversationsWithCode);
        }
    
        if (input.includeBreakdowns.includes('temporal')) {
          breakdowns.temporal = calculateTemporalBreakdown(summaries, filteredIds);
        }
    
        if (input.includeBreakdowns.includes('size')) {
          breakdowns.size = calculateSizeDistribution(summaries);
        }
    
        return {
          overview,
          breakdowns,
          scope: {
            type: input.scope,
            projectPath: input.projectPath,
            recentDays: input.scope === 'recent' ? input.recentDays : undefined,
            totalScanned: filteredIds.length
          },
          // Only include conversation details when requested (to control response size)
          conversationIds: input.includeConversationDetails ? filteredIds : [],
          conversations: input.includeConversationDetails ? summaries.map(s => ({
            composerId: s.composerId,
            messageCount: s.messageCount,
            size: s.conversationSize,
            files: s.relevantFiles.slice(0, 2), // Top 2 files only
            hasCodeBlocks: s.codeBlockCount > 0
          })) : []
        };
    
      } catch (error) {
        throw new DatabaseError(`Failed to get conversation analytics: ${error instanceof Error ? error.message : 'Unknown error'}`);
      } finally {
        reader.close();
      }
    }
  • Zod schema definition for GetConversationAnalyticsInput, defining parameters like scope, projectPath, recentDays, includeBreakdowns, and includeConversationDetails.
    export const getConversationAnalyticsSchema = z.object({
      scope: z.enum(['all', 'recent', 'project']).optional().default('all'),
      projectPath: z.string().optional(),
      recentDays: z.number().min(1).max(365).optional().default(30),
      includeBreakdowns: z.array(z.enum(['files', 'languages', 'temporal', 'size'])).optional().default(['files', 'languages']),
      includeConversationDetails: z.boolean().optional().default(false)
    });
  • src/server.ts:235-264 (registration)
    MCP server tool registration for 'get_conversation_analytics', including description, input schema, and handler wrapper that calls the analytics function and formats the response.
    server.tool(
      'get_conversation_analytics',
      'Get comprehensive analytics and statistics about Cursor chats including usage patterns, file activity, programming language distribution, and temporal trends. **BEST PRACTICE: Use projectPath parameter for project-specific analytics** - this analyzes only conversations that worked on files in that project, providing much more relevant insights for understanding coding patterns, file usage, and development activity within a specific codebase. WORKFLOW TIP: Always include "files" and "languages" in breakdowns - these contain conversation IDs in their arrays that you can immediately use with get_conversation tool. Use includeConversationDetails=true when you need the full conversation ID list and basic metadata for follow-up analysis.',
      {
        scope: z.enum(['all', 'recent', 'project']).optional().default('all').describe('Analysis scope: all conversations, recent only, or project-specific. Use "project" with projectPath for focused project analysis.'),
        projectPath: z.string().optional().describe('**HIGHLY RECOMMENDED** Project/codebase name (e.g., "my-app") or full path for project-scoped analysis. When provided, analyzes only conversations that worked on files in that project, giving much more relevant insights about coding patterns and development activity.'),
        recentDays: z.number().min(1).max(365).optional().default(30).describe('Number of recent days to analyze (1-365)'),
        includeBreakdowns: z.array(z.enum(['files', 'languages', 'temporal', 'size'])).optional().default(['files', 'languages']).describe('Types of breakdowns to include in the analysis. IMPORTANT: "files" and "languages" breakdowns contain conversation IDs in their arrays - use these for follow-up analysis!'),
        includeConversationDetails: z.boolean().optional().default(false).describe('Include full conversation ID list and basic metadata (increases response size significantly)'),
        outputMode: z.enum(['json', 'compact-json']).optional().default('json').describe('Output format: "json" for formatted JSON (default), "compact-json" for minified JSON')
      },
      async (input) => {
        try {
          const result = await getConversationAnalytics(input);
          return {
            content: [{
              type: 'text',
              text: formatResponse(result, input.outputMode)
            }]
          };
        } catch (error) {
          return {
            content: [{
              type: 'text',
              text: `Error: ${error instanceof Error ? error.message : 'Unknown error occurred'}`
            }]
          };
        }
      }
    );
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes key behavioral traits: it explains that using projectPath 'analyzes only conversations that worked on files in that project,' mentions that includeConversationDetails 'increases response size significantly,' and provides workflow tips for efficient usage. However, it doesn't address potential rate limits, authentication needs, or error conditions, leaving some gaps in behavioral context.

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

Conciseness4/5

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

The description is well-structured with clear sections (purpose, best practice, workflow tip) and uses bold text for emphasis. It's appropriately sized for a tool with 6 parameters and no annotations, though it could be slightly more concise by avoiding repetition of schema details (e.g., projectPath explanation appears in both description and schema). Every sentence adds value, but minor trimming is possible.

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

Completeness4/5

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

Given the tool's complexity (6 parameters, no output schema, no annotations), the description does a good job of providing context: it explains the tool's purpose, usage guidelines, and key behavioral aspects. However, it lacks details on output structure (since no output schema exists) and doesn't fully cover all behavioral traits like error handling or performance considerations, leaving room for improvement in completeness.

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?

The description adds some semantic context beyond the input schema, such as emphasizing projectPath as 'HIGHLY RECOMMENDED' and explaining its impact on relevance. However, with 100% schema description coverage, the schema already documents all parameters thoroughly (e.g., scope, recentDays, includeBreakdowns). The description reinforces but doesn't significantly expand on parameter meanings, meeting the baseline for high schema coverage.

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

Purpose5/5

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

The description clearly states the tool's purpose: 'Get comprehensive analytics and statistics about Cursor chats including usage patterns, file activity, programming language distribution, and temporal trends.' It specifies the verb ('Get') and resource ('analytics and statistics about Cursor chats') with detailed scope, distinguishing it from siblings like 'list_conversations' or 'get_conversation' that focus on individual conversations rather than aggregated analytics.

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

Usage Guidelines5/5

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

The description provides explicit usage guidelines: it includes a 'BEST PRACTICE' section recommending the projectPath parameter for project-specific analytics and a 'WORKFLOW TIP' advising to always include 'files' and 'languages' in breakdowns for follow-up analysis with get_conversation. It also mentions when to use includeConversationDetails=true, offering clear alternatives and context for effective tool selection.

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/vltansky/cursor-conversations-mcp'

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