mcp-adr-analysis-server
Version:
MCP server for analyzing Architectural Decision Records and project architecture
90 lines • 2.99 kB
TypeScript
/**
* Memory Expand Resource - Detailed view of a specific memory entity
* URI Pattern: adr://memory/{key}
*/
import { URLSearchParams } from 'url';
import { ResourceGenerationResult } from './index.js';
import type { MemoryEntityManager } from '../utils/memory-entity-manager.js';
export interface MemoryExpandData {
key: string;
entity: {
id: string;
type: string;
name: string;
content: any;
metadata: Record<string, any>;
tags: string[];
confidence: number;
lastModified: string;
created: string;
accessCount: number;
} | null;
relationships: Array<{
targetId: string;
targetName: string;
relationshipType: string;
strength: number;
}>;
relatedEntities: Array<{
id: string;
name: string;
type: string;
relevance: number;
}>;
timestamp: string;
found: boolean;
}
/**
* Generate memory expand resource showing detailed entity information.
*
* Returns complete details about a specific memory entity including:
* - Full entity content and metadata
* - All relationships to other entities
* - Related entities by relevance
* - Access statistics
*
* **URI Pattern:** `adr://memory/{key}`
*
* **Query Parameters:**
* - `includeRelated`: Include related entities (default: true)
* - `relationshipDepth`: Depth of relationships to traverse (default: 2)
* - `maxRelated`: Maximum related entities to return (default: 10)
*
* @param params - URL path parameters containing:
* - key: Memory entity key/ID
* @param searchParams - URL query parameters for customization
* @param memoryManager - Optional memory entity manager instance
*
* @returns Promise resolving to resource generation result containing:
* - data: Complete memory entity data with relationships
* - contentType: "application/json"
* - lastModified: ISO timestamp of generation
* - cacheKey: Unique identifier "memory-expand:{key}"
* - ttl: Cache duration (60 seconds / 1 minute)
* - etag: Entity tag for cache validation
*
* @throws {McpAdrError} When memory expansion fails
*
* @example
* ```typescript
* // Get expanded memory entity
* const memory = await generateMemoryExpandResource(
* { key: 'adr-001' },
* new URLSearchParams()
* );
*
* console.log(`Entity type: ${memory.data.entity?.type}`);
* console.log(`Relationships: ${memory.data.relationships.length}`);
*
* // With custom depth
* const deep = await generateMemoryExpandResource(
* { key: 'architecture-context' },
* new URLSearchParams('relationshipDepth=3&maxRelated=20')
* );
* ```
*
* @since v2.2.0
* @see {@link MemoryEntityManager} for memory management
*/
export declare function generateMemoryExpandResource(params: Record<string, string>, searchParams: URLSearchParams, memoryManager?: MemoryEntityManager): Promise<ResourceGenerationResult>;
//# sourceMappingURL=memory-expand-resource.d.ts.map