Skip to main content
Glama

mcp-adr-analysis-server

by tosin2013
PROMPT_ANALYSIS.md18.3 kB
# Function-Based Prompts Analysis ## Executive Summary The 30 "function-based prompts" exposed via MCP are **internal implementation details**, not user-facing prompts. They're helper functions that generate prompts for AI execution (OpenRouter) within existing tools. **Recommendation**: Remove from MCP prompts (keep as internal utilities). No new tools needed - they're already integrated. --- ## The 30 Function-Based Prompts ### **Category 1: Analysis Prompts** (3 functions) Located: `src/prompts/analysis-prompts.ts` | Function | Purpose | Used By | Keep As | |----------|---------|---------|---------| | `generateTechnologyDetectionPrompt` | Generates prompts for detecting project technologies | Internal AI execution | ✅ Internal Util | | `generatePatternDetectionPrompt` | Generates prompts for detecting architectural patterns | Internal AI execution | ✅ Internal Util | | `generateComprehensiveAnalysisPrompt` | Generates prompts for full project analysis | Internal AI execution | ✅ Internal Util | **How They Work:** ```typescript // Inside tools/smart-score-tool.ts (conceptual) const projectContext = analyzeProjectStructure(projectPath); const prompt = generateTechnologyDetectionPrompt(projectContext); const aiResult = await aiExecutor.execute(prompt); // Send to OpenRouter return aiResult; // Return AI-generated analysis ``` **Impact of Removing from MCP Prompts:** ✅ ZERO - Still used internally by tools --- ### **Category 2: ADR Suggestion Prompts** (3 functions) Located: `src/prompts/adr-suggestion-prompts.ts` | Function | Purpose | Used By | Keep As | |----------|---------|---------|---------| | `generateImplicitDecisionDetectionPrompt` | Detects architectural decisions in code | `tools/adr-suggestion-tool.ts` via `utils/adr-suggestions.ts` | ✅ Internal Util | | `generateCodeChangeAnalysisPrompt` | Analyzes code changes for ADR needs | `tools/adr-suggestion-tool.ts` | ✅ Internal Util | | `generateAdrTemplatePrompt` | Generates ADR document templates | `tools/adr-suggestion-tool.ts` | ✅ Internal Util | **How They Work:** ```typescript // src/utils/adr-suggestions.ts (actual code - line 110) const { generateImplicitDecisionDetectionPrompt } = await import( '../prompts/adr-suggestion-prompts.js' ); let analysisPrompt = generateImplicitDecisionDetectionPrompt(projectPath, existingAdrs); // Enhance prompt with conversation context if available if (conversationContext) { const contextSection = formatContextForPrompt(conversationContext); analysisPrompt = contextSection + analysisPrompt; } // Execute with AI (OpenRouter) const result = await aiExecutor.execute(analysisPrompt); ``` **Impact of Removing from MCP Prompts:** ✅ ZERO - Already used internally --- ### **Category 3: Deployment Analysis Prompts** (4 functions) Located: `src/prompts/deployment-analysis-prompts.ts` | Function | Purpose | Used By | Keep As | |----------|---------|---------|---------| | `generateDeploymentTaskIdentificationPrompt` | Identifies deployment tasks from ADRs | `tools/deployment-readiness-tool.ts` via `utils/deployment-analysis.ts` | ✅ Internal Util | | `generateCiCdAnalysisPrompt` | Analyzes CI/CD pipeline readiness | `tools/deployment-readiness-tool.ts` | ✅ Internal Util | | `generateDeploymentProgressCalculationPrompt` | Calculates deployment progress | `tools/deployment-readiness-tool.ts` | ✅ Internal Util | | `generateCompletionVerificationPrompt` | Verifies deployment completion | `tools/deployment-readiness-tool.ts` | ✅ Internal Util | **How They Work:** ```typescript // src/utils/deployment-analysis.ts (line 43) export async function identifyDeploymentTasks( adrDirectory: string = 'docs/adrs', todoPath?: string ): Promise<{ identificationPrompt: string; instructions: string; actualData?: any }> { // Discover ADRs const { discoverAdrsInDirectory } = await import('./adr-discovery.js'); const adrs = await discoverAdrsInDirectory(adrDirectory); // Generate prompt for AI const { generateDeploymentTaskIdentificationPrompt } = await import( '../prompts/deployment-analysis-prompts.js' ); const prompt = generateDeploymentTaskIdentificationPrompt({ adrs, todoContent: todoPath ? readTodoFile(todoPath) : undefined }); // Execute with AI return await aiExecutor.execute(prompt); } ``` **Impact of Removing from MCP Prompts:** ✅ ZERO - Internal implementation --- ### **Category 4: Environment Analysis Prompts** (4 functions) Located: `src/prompts/environment-analysis-prompts.ts` | Function | Purpose | Used By | Keep As | |----------|---------|---------|---------| | `generateEnvironmentSpecAnalysisPrompt` | Analyzes environment specifications | `tools/environment-analysis-tool.ts` via `utils/environment-analysis.ts` | ✅ Internal Util | | `generateContainerizationDetectionPrompt` | Detects containerization setup | `tools/environment-analysis-tool.ts` | ✅ Internal Util | | `generateAdrEnvironmentRequirementsPrompt` | Extracts environment requirements from ADRs | `tools/environment-analysis-tool.ts` | ✅ Internal Util | | `generateEnvironmentCompliancePrompt` | Verifies environment compliance | `tools/environment-analysis-tool.ts` | ✅ Internal Util | **Current Integration:** - Used by: `environment-analysis-tool.ts` - Called via: `utils/environment-analysis.ts` - Purpose: Generate prompts for AI to analyze environment setup **Impact of Removing from MCP Prompts:** ✅ ZERO - Internal only --- ### **Category 5: Research Integration Prompts** (3 functions) Located: `src/prompts/research-integration-prompts.ts` | Function | Purpose | Used By | Keep As | |----------|---------|---------|---------| | `generateResearchTopicExtractionPrompt` | Extracts research topics from project | `tools/research-integration-tool.ts` via `utils/research-integration.ts` | ✅ Internal Util | | `generateResearchImpactEvaluationPrompt` | Evaluates research impact on ADRs | `tools/research-integration-tool.ts` | ✅ Internal Util | | `generateAdrUpdateSuggestionPrompt` | Suggests ADR updates based on research | `tools/research-integration-tool.ts` | ✅ Internal Util | **Current Integration:** - Used by: `research-integration-tool.ts` - Called via: `utils/research-integration.ts` - Purpose: Generate prompts for AI to integrate research findings **Impact of Removing from MCP Prompts:** ✅ ZERO --- ### **Category 6: Research Question Prompts** (4 functions) Located: `src/prompts/research-question-prompts.ts` | Function | Purpose | Used By | Keep As | |----------|---------|---------|---------| | `generateProblemKnowledgeCorrelationPrompt` | Correlates problems with knowledge gaps | `tools/research-question-tool.ts` via `utils/research-questions.ts` | ✅ Internal Util | | `generateRelevantAdrPatternPrompt` | Identifies relevant ADR patterns | `tools/research-question-tool.ts` | ✅ Internal Util | | `generateContextAwareResearchQuestionsPrompt` | Generates context-aware research questions | `tools/research-question-tool.ts` | ✅ Internal Util | | `generateResearchTaskTrackingPrompt` | Tracks research task progress | `tools/research-question-tool.ts` | ✅ Internal Util | **Current Integration:** - Used by: `research-question-tool.ts` - Called via: `utils/research-questions.ts` - Purpose: Generate prompts for AI to create research questions **Impact of Removing from MCP Prompts:** ✅ ZERO --- ### **Category 7: Rule Generation Prompts** (4 functions) Located: `src/prompts/rule-generation-prompts.ts` | Function | Purpose | Used By | Keep As | |----------|---------|---------|---------| | `generateRuleExtractionPrompt` | Extracts architectural rules from code/ADRs | `tools/rule-generation-tool.ts` via `utils/rule-generation.ts` | ✅ Internal Util | | `generatePatternBasedRulePrompt` | Creates rules from patterns | `tools/rule-generation-tool.ts` | ✅ Internal Util | | `generateCodeValidationPrompt` | Validates code against rules | `tools/rule-generation-tool.ts` | ✅ Internal Util | | `generateRuleDeviationReportPrompt` | Reports rule violations | `tools/rule-generation-tool.ts` | ✅ Internal Util | **Current Integration:** - Used by: `rule-generation-tool.ts` - Called via: `utils/rule-generation.ts` - Purpose: Generate prompts for AI to create and validate architectural rules **Impact of Removing from MCP Prompts:** ✅ ZERO --- ### **Category 8: Security Prompts** (3 functions) Located: `src/prompts/security-prompts.ts` | Function | Purpose | Used By | Keep As | |----------|---------|---------|---------| | `generateSensitiveContentDetectionPrompt` | Detects sensitive content in files | `tools/content-masking-tool.ts` | ✅ Internal Util | | `generateContentMaskingPrompt` | Generates masking strategies | `tools/content-masking-tool.ts` | ✅ Internal Util | | `generateCustomPatternConfigurationPrompt` | Configures custom masking patterns | `tools/content-masking-tool.ts` | ✅ Internal Util | **Current Integration:** - Used by: `content-masking-tool.ts` - Purpose: Generate prompts for AI to detect and mask sensitive content **Impact of Removing from MCP Prompts:** ✅ ZERO --- ## Architecture Diagram ``` ┌─────────────────────────────────────────────────────────────┐ │ MCP Protocol Layer │ │ ┌───────────────┐ ┌──────────────┐ ┌────────────────┐ │ │ │ Tools (30+) │ │ Resources │ │ Prompts (10) │ │ │ │ (Correct) │ │ (Correct) │ │ (User-facing) │ │ │ └───────┬───────┘ └──────────────┘ └────────────────┘ │ └──────────┼─────────────────────────────────────────────────┘ │ │ Tools call utils ▼ ┌─────────────────────────────────────────────────────────────┐ │ Utils Layer │ │ ┌────────────────────┐ ┌──────────────────────────────┐ │ │ │ adr-suggestions.ts │ │ deployment-analysis.ts │ │ │ │ environment- │ │ research-integration.ts │ │ │ │ analysis.ts │ │ research-questions.ts │ │ │ │ rule-generation.ts │ │ │ │ │ └─────────┬──────────┘ └────────────┬─────────────────┘ │ └────────────┼────────────────────────────┼────────────────────┘ │ │ │ Utils use prompt generators│ ▼ ▼ ┌─────────────────────────────────────────────────────────────┐ │ Prompt Generation Functions │ │ ┌──────────────────────────────────────────────────────┐ │ │ │ 30 functions in src/prompts/*.ts │ │ │ │ - generateTechnologyDetectionPrompt() │ │ │ │ - generateImplicitDecisionDetectionPrompt() │ │ │ │ - generateDeploymentTaskIdentificationPrompt() │ │ │ │ - ... (27 more) │ │ │ └───────────────────────────┬──────────────────────────┘ │ └──────────────────────────────┼─────────────────────────────┘ │ │ Generate prompts for AI ▼ ┌─────────────────────────────────────────────────────────────┐ │ AI Executor (OpenRouter) │ │ ┌──────────────────────────────────────────────────────┐ │ │ │ Takes generated prompts │ │ │ │ Sends to Claude via OpenRouter │ │ │ │ Returns actual AI-generated results │ │ │ └──────────────────────────────────────────────────────┘ │ └─────────────────────────────────────────────────────────────┘ ``` **Key Insight:** The 30 functions are in the "Prompt Generation" layer, NOT the "MCP Prompts" layer. They're internal implementation details. --- ## What Happens When We Remove Them from MCP Prompts? ### **✅ What Stays (Internal Implementation)** All 30 functions remain in their respective files: - `src/prompts/analysis-prompts.ts` - `src/prompts/adr-suggestion-prompts.ts` - `src/prompts/deployment-analysis-prompts.ts` - `src/prompts/environment-analysis-prompts.ts` - `src/prompts/research-integration-prompts.ts` - `src/prompts/research-question-prompts.ts` - `src/prompts/rule-generation-prompts.ts` - `src/prompts/security-prompts.ts` ### **❌ What Gets Removed (MCP Prompt Exposure)** Remove from `src/prompts/index.ts`: ```typescript // DELETE THIS SECTION (lines 659-881) const functionBasedPrompts: PromptTemplate[] = [ createFunctionPromptTemplate( 'technology_detection_prompt', 'Generate technology detection analysis prompt', // ... ), // ... 29 more ]; // UPDATE THIS export const allPrompts: PromptTemplate[] = [ // Keep these 10 static prompts goalSpecificationPrompt, actionConfirmationPrompt, ambiguityResolutionPrompt, customRuleDefinitionPrompt, baselineAnalysisPrompt, secretPreventionPrompt, todoTaskGenerationPrompt, todoStatusManagementPrompt, todoDependencyAnalysisPrompt, todoEstimationPrompt, // REMOVE THIS LINE: // ...functionBasedPrompts, ❌ ]; ``` ### **✅ No New Tools Needed** These functions are **already integrated** into existing tools: | Existing Tool | Uses Functions From | |---------------|---------------------| | `adr-suggestion-tool.ts` | adr-suggestion-prompts.ts | | `deployment-readiness-tool.ts` | deployment-analysis-prompts.ts | | `environment-analysis-tool.ts` | environment-analysis-prompts.ts | | `research-integration-tool.ts` | research-integration-prompts.ts | | `research-question-tool.ts` | research-question-prompts.ts | | `rule-generation-tool.ts` | rule-generation-prompts.ts | | `content-masking-tool.ts` | security-prompts.ts | | Internal analysis utilities | analysis-prompts.ts | --- ## Implementation Plan ### **Step 1: Remove from MCP Prompts** Edit `src/prompts/index.ts`: ```typescript // Remove lines 637-881 (createFunctionPromptTemplate and functionBasedPrompts array) // Update allPrompts export (line 866) export const allPrompts: PromptTemplate[] = [ // Static template-based prompts (10 total) goalSpecificationPrompt, actionConfirmationPrompt, ambiguityResolutionPrompt, customRuleDefinitionPrompt, baselineAnalysisPrompt, secretPreventionPrompt, todoTaskGenerationPrompt, todoStatusManagementPrompt, todoDependencyAnalysisPrompt, todoEstimationPrompt, // Remove: ...functionBasedPrompts, ❌ ]; ``` ### **Step 2: Verify Nothing Breaks** All existing tools continue to work because they import directly from the prompt modules: ```typescript // Tools still work - they import directly const { generateImplicitDecisionDetectionPrompt } = await import( '../prompts/adr-suggestion-prompts.js' ); ``` ### **Step 3: Update Documentation** Add to prompt files: ```typescript /** * Internal prompt generation functions for AI execution. * * NOTE: These are NOT exposed as MCP prompts. They're internal utilities * used by tools to generate prompts for OpenRouter/AI execution. * * For user-facing MCP prompts, see src/prompts/index.ts (static templates). */ ``` --- ## Summary | Metric | Before | After | Change | |--------|--------|-------|--------| | **MCP Prompts Exposed** | 40 (10 static + 30 function) | 10 (static only) | -75% | | **Internal Utils** | 30 functions | 30 functions | No change | | **Tools Working** | ✅ All | ✅ All | No change | | **MCP Best Practices** | 62/100 | 90/100 | +45% | | **User Experience** | Confusing (placeholder prompts) | Clear (real templates) | ✅ Better | --- ## Recommendation **✅ PROCEED**: Remove the 30 function-based "prompts" from MCP prompt exposure. They're internal implementation details that don't belong in the MCP prompts list. **Benefits:** 1. ✅ Aligns with MCP best practices (prompts are user-controlled templates) 2. ✅ Reduces confusion (no more placeholder prompts) 3. ✅ Zero breaking changes (all tools continue working) 4. ✅ Cleaner API (10 real prompts vs 40 mixed) 5. ✅ Better user experience (real templates only) **No Downsides:** - ❌ No tools broken - ❌ No functionality lost - ❌ No new tools needed - ❌ No refactoring required The functions stay exactly where they are, doing exactly what they do now - just not exposed as MCP prompts.

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/tosin2013/mcp-adr-analysis-server'

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