find_related_content
Discover content related to projects, tasks, or documents by identifying similar, dependent, linked, or recent items to enhance context and connections.
Instructions
Find content related to a specific entity (project, task, or document)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| entity_type | Yes | Type of entity to find related content for | |
| entity_id | Yes | ID of the entity | |
| relation_types | No | Types of relationships to find | |
| max_results | No | Maximum number of related items to return |
Implementation Reference
- src/tools/context-aggregation.ts:349-378 (handler)Main handler function that executes the find_related_content tool logic. Parses input using schema, fetches source entity, finds relationships by type, analyzes them, and returns structured related content.export const findRelatedContent = requireAuth(async (args: any) => { const { entity_type, entity_id, relation_types, max_results } = FindRelatedContentSchema.parse(args) logger.info('Finding related content', { entity_type, entity_id, relation_types }) const relatedContent: any = { source_entity: await getSourceEntity(entity_type, entity_id), relationships: {} } for (const relationType of relation_types) { try { relatedContent.relationships[relationType] = await findRelationshipsByType( entity_type, entity_id, relationType, max_results ) } catch (error) { logger.error(`Error finding ${relationType} relationships:`, error) relatedContent.relationships[relationType] = [] } } // Calculate relationship strength and add metadata relatedContent.analysis = analyzeRelationships(relatedContent.relationships) relatedContent.suggestions = generateRelationshipSuggestions(relatedContent) return relatedContent })
- Zod schema defining input validation for the find_related_content tool parameters: entity_type, entity_id, relation_types, and max_results.const FindRelatedContentSchema = z.object({ entity_type: z.enum(['project', 'task', 'document']), entity_id: z.string().uuid(), relation_types: z.array(z.enum(['similar', 'dependent', 'linked', 'recent'])).default(['similar', 'linked']), max_results: z.number().int().positive().max(50).default(10) })
- src/tools/context-aggregation.ts:310-345 (registration)MCPTool object registration for find_related_content, including name, description, and JSON schema for input validation.export const findRelatedContentTool: MCPTool = { name: 'find_related_content', description: 'Find content related to a specific entity (project, task, or document)', inputSchema: { type: 'object', properties: { entity_type: { type: 'string', enum: ['project', 'task', 'document'], description: 'Type of entity to find related content for' }, entity_id: { type: 'string', format: 'uuid', description: 'ID of the entity' }, relation_types: { type: 'array', items: { type: 'string', enum: ['similar', 'dependent', 'linked', 'recent'] }, default: ['similar', 'linked'], description: 'Types of relationships to find' }, max_results: { type: 'number', minimum: 1, maximum: 50, default: 10, description: 'Maximum number of related items to return' } }, required: ['entity_type', 'entity_id'] } }
- src/tools/context-aggregation.ts:724-730 (registration)Handler registry mapping the snake_case tool name 'find_related_content' to its handler function.export const contextAggregationHandlers = { get_smart_context: getSmartContext, get_workspace_overview: getWorkspaceOverview, get_project_insights: getProjectInsights, find_related_content: findRelatedContent, generate_context_summary: generateContextSummary }
- Internal helper function for finding related content, used within getSmartContext tool (not directly in find_related_content).async function findRelatedContentInternal(results: any, queryAnalysis: any): Promise<any> { // Find connections between different types of content const related = { cross_references: [], common_topics: [], related_projects: [] } // This would implement more sophisticated relationship finding return related }
- src/tools/context-aggregation.ts:716-722 (registration)Tool registry exporting the findRelatedContentTool MCPTool object.export const contextAggregationTools = { getSmartContextTool, getWorkspaceOverviewTool, getProjectInsightsTool, findRelatedContentTool, generateContextSummaryTool }