Skip to main content
Glama
vltansky

Cursor Conversations MCP Server

find_related_conversations

Discover conversations related to a specific discussion by analyzing shared files, folders, programming languages, size, or timing. Use this tool to identify similar problem-solving sessions, trace idea evolution, or find discussions about the same codebase.

Instructions

Find conversations related to a reference conversation based on shared files, folders, programming languages, similar size, or temporal proximity. Use this to discover related discussions, find conversations about the same codebase/project, identify similar problem-solving sessions, or trace the evolution of ideas across multiple conversations.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
referenceConversationIdYesID of the conversation to find related conversations for
relationshipTypesNoTypes of relationships to consider when finding related conversations
maxResultsNoMaximum number of related conversations to return (1-50)
minScoreNoMinimum similarity score threshold (0.0-1.0)
includeScoreBreakdownNoInclude detailed breakdown of how similarity scores were calculated
outputModeNoOutput format: "json" for formatted JSON (default), "compact-json" for minified JSONjson

Implementation Reference

  • src/server.ts:266-295 (registration)
    MCP server registration of the 'find_related_conversations' tool, including input schema validation and thin wrapper handler that formats the response.
    server.tool(
      'find_related_conversations',
      'Find conversations related to a reference conversation based on shared files, folders, programming languages, similar size, or temporal proximity. Use this to discover related discussions, find conversations about the same codebase/project, identify similar problem-solving sessions, or trace the evolution of ideas across multiple conversations.',
      {
        referenceConversationId: z.string().min(1).describe('ID of the conversation to find related conversations for'),
        relationshipTypes: z.array(z.enum(['files', 'folders', 'languages', 'size', 'temporal'])).optional().default(['files']).describe('Types of relationships to consider when finding related conversations'),
        maxResults: z.number().min(1).max(50).optional().default(10).describe('Maximum number of related conversations to return (1-50)'),
        minScore: z.number().min(0).max(1).optional().default(0.1).describe('Minimum similarity score threshold (0.0-1.0)'),
        includeScoreBreakdown: z.boolean().optional().default(false).describe('Include detailed breakdown of how similarity scores were calculated'),
        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 findRelatedConversations(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'}`
            }]
          };
        }
      }
    );
  • Primary handler function that connects to the database, retrieves summaries for the reference conversation and all others, extracts languages if needed, and delegates relationship computation to the utility function.
    export async function findRelatedConversations(
      input: FindRelatedConversationsInput
    ): Promise<RelatedConversationsResult> {
      const reader = new CursorDatabaseReader();
    
      try {
        await reader.connect();
    
        // Get reference conversation summary
        const referenceSummary = await reader.getConversationSummary(input.referenceConversationId, {
          includeFirstMessage: true,
          includeCodeBlockCount: true,
          includeFileList: true,
          includeAttachedFolders: true,
          maxFirstMessageLength: 150
        });
    
        if (!referenceSummary) {
          throw new DatabaseError(`Reference conversation ${input.referenceConversationId} not found`);
        }
    
        // Get all conversation IDs for comparison
        const allConversationIds = await reader.getConversationIds({
          format: 'both',
          minLength: 100
        });
    
        // Get summaries for all conversations
        const allSummaries = await reader.getConversationSummariesForAnalytics(allConversationIds);
    
        // Extract languages from reference conversation if needed
        let referenceLanguages: string[] = [];
        if (input.relationshipTypes.includes('languages')) {
          const conversationsWithCode = await reader.getConversationsWithCodeBlocks([input.referenceConversationId]);
          if (conversationsWithCode.length > 0) {
            referenceLanguages = extractLanguagesFromCodeBlocks(conversationsWithCode[0].codeBlocks);
          }
        }
    
        // Find related conversations
        const related = findRelatedConversationsUtil(
          referenceSummary,
          allSummaries,
          allConversationIds,
          {
            relationshipTypes: input.relationshipTypes,
            maxResults: input.maxResults,
            minScore: input.minScore,
            includeScoreBreakdown: input.includeScoreBreakdown
          }
        );
    
        return {
          reference: {
            composerId: referenceSummary.composerId,
            files: referenceSummary.relevantFiles,
            folders: referenceSummary.attachedFolders,
            languages: referenceLanguages,
            messageCount: referenceSummary.messageCount,
            size: referenceSummary.conversationSize
          },
          related
        };
    
      } catch (error) {
        throw new DatabaseError(`Failed to find related conversations: ${error instanceof Error ? error.message : 'Unknown error'}`);
      } finally {
        reader.close();
      }
    }
  • Zod schema definition for input validation of the findRelatedConversations tool (used for TypeScript typing).
    export const findRelatedConversationsSchema = z.object({
      referenceConversationId: z.string().min(1),
      relationshipTypes: z.array(z.enum(['files', 'folders', 'languages', 'size', 'temporal'])).optional().default(['files']),
      maxResults: z.number().min(1).max(50).optional().default(10),
      minScore: z.number().min(0).max(1).optional().default(0.1),
      includeScoreBreakdown: z.boolean().optional().default(false)
    });
  • Core utility function (aliased as findRelatedConversationsUtil) that iterates over all conversation summaries, computes relationship scores (files, folders, etc.), and returns top related conversations sorted by composite score.
    export function findRelatedConversations(
      referenceSummary: ConversationSummary,
      allSummaries: ConversationSummary[],
      conversationIds: string[],
      options: RelationshipOptions
    ): RelatedConversation[] {
      const related: RelatedConversation[] = [];
    
      // Get reference conversation index for temporal calculations
      const referenceIndex = conversationIds.indexOf(referenceSummary.composerId);
    
      for (const summary of allSummaries) {
        // Skip the reference conversation itself
        if (summary.composerId === referenceSummary.composerId) {
          continue;
        }
    
        const relationships = calculateRelationships(
          referenceSummary,
          summary,
          conversationIds,
          referenceIndex,
          options.relationshipTypes
        );
    
        const score = calculateCompositeScore(relationships, options.relationshipTypes);
    
        if (score >= options.minScore) {
          related.push({
            composerId: summary.composerId,
            relationshipScore: score,
            relationships,
            summary: summary.firstMessage || 'No preview available',
            scoreBreakdown: options.includeScoreBreakdown ?
              calculateScoreBreakdown(relationships, options.relationshipTypes) : undefined
          });
        }
      }
    
      // Sort by score and limit results
      return related
        .sort((a, b) => b.relationshipScore - a.relationshipScore)
        .slice(0, options.maxResults);
    }
Behavior3/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 describes what the tool does (find related conversations based on specified relationship types) and mentions similarity scores, but doesn't cover important behavioral aspects like whether this is a read-only operation, potential performance characteristics, rate limits, authentication requirements, or error conditions. It adds some context about relationship types but leaves gaps in operational transparency.

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 appropriately sized with two sentences. The first sentence clearly states the purpose and relationship types, while the second provides usage guidance. There's minimal waste, though the second sentence could be slightly more concise. The structure is front-loaded with the core functionality.

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

Completeness3/5

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

Given the tool's moderate complexity (6 parameters, relationship-based matching), no annotations, and no output schema, the description provides adequate purpose and usage context but lacks details about behavioral characteristics, return format, error handling, and performance considerations. It's complete enough for basic understanding but has gaps for operational use.

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 schema description coverage is 100%, so the schema already documents all 6 parameters thoroughly. The description mentions relationship types (files, folders, languages, size, temporal) which aligns with the 'relationshipTypes' parameter, but doesn't add significant meaning beyond what's in the schema descriptions. The baseline of 3 is appropriate when the schema does the heavy lifting.

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 with specific verbs ('find conversations related to') and resources ('reference conversation'), and distinguishes it from siblings by focusing on relationship-based discovery rather than listing, searching, exporting, or analyzing conversations. It explicitly mentions the relationship types (files, folders, languages, size, temporal) that differentiate its functionality.

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 guidance on when to use this tool: 'to discover related discussions, find conversations about the same codebase/project, identify similar problem-solving sessions, or trace the evolution of ideas across multiple conversations.' This gives clear context for application scenarios, though it doesn't explicitly mention when NOT to use it or name specific alternatives among siblings.

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