mcp-adr-analysis-server
Version:
MCP server for analyzing Architectural Decision Records and project architecture
107 lines • 3.55 kB
TypeScript
/**
* Pattern Research Utility
*
* This utility enables LLMs to query authoritative pattern sources
* for live, up-to-date information before applying deployment patterns.
*
* The system uses WebFetch to retrieve current best practices from
* official documentation, repositories, and community resources.
*/
import { PatternSource, PlatformType } from './validated-pattern-definitions.js';
/**
* Research result from a pattern source
*/
export interface PatternResearchResult {
source: PatternSource;
findings: string;
confidence: number;
timestamp: string;
success: boolean;
error?: string;
}
/**
* Aggregated research for a pattern
*/
export interface AggregatedPatternResearch {
platformType: PlatformType;
patternVersion: string;
requiredSourcesQueried: number;
totalSourcesQueried: number;
overallConfidence: number;
results: PatternResearchResult[];
summary: string;
recommendations: string[];
updatedAt: string;
}
/**
* Pattern Research Utility
*
* Queries authoritative sources to get the latest pattern information.
* LLMs should use this before applying patterns to ensure they follow
* current best practices.
*/
export declare class PatternResearchUtility {
private logger;
private researchCache;
private cacheTTL;
constructor();
/**
* Research a pattern by querying all its authoritative sources
*
* This method should be called by LLMs before applying a deployment pattern.
* It fetches the latest information from official documentation, repositories,
* and community resources to ensure the pattern follows current best practices.
*
* @param platformType - The platform to research
* @param queryRequired - If true, only query required sources
* @param useCache - Whether to use cached research if available
* @returns Aggregated research results
*/
researchPattern(platformType: PlatformType, queryRequired?: boolean, useCache?: boolean): Promise<AggregatedPatternResearch>;
/**
* Query a single pattern source
*
* This method constructs a prompt to guide the LLM in extracting
* relevant information from the authoritative source.
*
* NOTE: This method returns instructions for the LLM rather than
* actually fetching content, since WebFetch must be called by the LLM itself.
*/
private querySource;
/**
* Generate instructions for the LLM to query a source
*/
private generateQueryInstructions;
/**
* Aggregate results from multiple sources
*/
private aggregateResults;
/**
* Generate a summary of research findings
*/
private generateSummary;
/**
* Generate recommendations based on research
*/
private generateRecommendations;
/**
* Generate a research report for the LLM
*
* This creates a formatted report that the LLM can read to understand
* what research needs to be done before applying a pattern.
*/
generateResearchReport(platformType: PlatformType): string;
/**
* Clear research cache
*/
clearCache(): void;
}
/**
* Helper function to research a pattern
*/
export declare function researchPattern(platformType: PlatformType, queryRequired?: boolean): Promise<AggregatedPatternResearch>;
/**
* Helper function to generate a research report
*/
export declare function generatePatternResearchReport(platformType: PlatformType): string;
//# sourceMappingURL=pattern-research-utility.d.ts.map