Skip to main content
Glama

enhance_prompt

Read-onlyIdempotent

Transform vague AI prompts into clear, specific, and context-rich instructions to improve response quality and accuracy.

Instructions

구체적으로|자세히|명확하게|더 구체적으로|be specific|more detail|clarify|elaborate|vague - Transform vague requests

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
promptYesOriginal prompt to enhance
contextNoAdditional context or project information
enhancement_typeNoType of enhancement (default: all)

Implementation Reference

  • The main execution handler for the 'enhance_prompt' tool. It takes a prompt and optional context/enhancement_type, analyzes vagueness, and returns a structured, enhanced prompt with improvements in clarity, specificity, and context.
    export async function enhancePrompt(args: { prompt: string; context?: string; enhancement_type?: string }): Promise<ToolResult> {
      const { prompt, context = '', enhancement_type = 'all' } = args;
      
      // Enhancement logic
      const enhancements: Record<string, string[]> = {
        clarity: [],
        specificity: [],
        context: [],
        structure: []
      };
      
      // Analyze original prompt
      const promptLength = prompt.length;
      const hasQuestion = prompt.includes('?');
      const hasSpecificTerms = /\b(구현|개발|수정|분석|디버그|리팩토링)\b/i.test(prompt);
      
      // Apply enhancements based on type
      if (enhancement_type === 'clarity' || enhancement_type === 'all') {
        if (promptLength < 20) {
          enhancements.clarity.push('더 구체적인 설명 추가');
        }
        if (!hasQuestion && !hasSpecificTerms) {
          enhancements.clarity.push('명확한 요청이나 질문 형태로 변환');
        }
      }
      
      if (enhancement_type === 'specificity' || enhancement_type === 'all') {
        if (!prompt.match(/\b(언어|프레임워크|라이브러리|버전)\b/)) {
          enhancements.specificity.push('기술 스택 명시');
        }
        if (!prompt.match(/\b(입력|출력|결과|형식)\b/)) {
          enhancements.specificity.push('예상 입출력 정의');
        }
      }
      
      if (enhancement_type === 'context' || enhancement_type === 'all') {
        if (!prompt.match(/\b(목적|이유|배경|상황)\b/)) {
          enhancements.context.push('작업 목적과 배경 추가');
        }
        if (context) {
          enhancements.context.push('제공된 컨텍스트 통합');
        }
      }
      
      // Generate enhanced prompt
      let enhancedPrompt = prompt;
      
      // Build enhanced version
      const components = [];
      
      // Add objective
      components.push(`**목표**: ${prompt}`);
      
      // Add context if provided
      if (context) {
        components.push(`**배경**: ${context}`);
      }
      
      // Add specific requirements based on analysis
      const requirements = [];
      if (enhancements.specificity.includes('기술 스택 명시')) {
        requirements.push('- 사용할 언어/프레임워크를 명시해주세요');
      }
      if (enhancements.specificity.includes('예상 입출력 정의')) {
        requirements.push('- 예상되는 입력과 출력 형식을 설명해주세요');
      }
      
      if (requirements.length > 0) {
        components.push(`**요구사항**:\n${requirements.join('\n')}`);
      }
      
      // Add quality considerations
      const quality = [
        '- 에러 처리 포함',
        '- 테스트 가능한 구조',
        '- 확장 가능한 설계'
      ];
      components.push(`**품질 기준**:\n${quality.join('\n')}`);
      
      enhancedPrompt = components.join('\n\n');
      
      const result = {
        action: 'enhance_prompt',
        original: prompt,
        enhanced: enhancedPrompt,
        enhancements,
        improvements: [
          enhancements.clarity.length > 0 ? `명확성 개선 (${enhancements.clarity.length}개)` : null,
          enhancements.specificity.length > 0 ? `구체성 추가 (${enhancements.specificity.length}개)` : null,
          enhancements.context.length > 0 ? `맥락 보강 (${enhancements.context.length}개)` : null
        ].filter(Boolean),
        status: 'success'
      };
      
      return {
        content: [{ type: 'text', text: `Original: ${prompt}\n\nEnhanced:\n${enhancedPrompt}\n\nImprovements: ${result.improvements.join(', ')}` }]
      };
    }
  • The ToolDefinition object defining the input schema, description, and metadata for the 'enhance_prompt' tool.
    export const enhancePromptDefinition: ToolDefinition = {
      name: 'enhance_prompt',
      description: '구체적으로|자세히|명확하게|더 구체적으로|be specific|more detail|clarify|elaborate|vague - Transform vague requests',
      inputSchema: {
        type: 'object',
        properties: {
          prompt: { type: 'string', description: 'Original prompt to enhance' },
          context: { type: 'string', description: 'Additional context or project information' },
          enhancement_type: {
            type: 'string',
            enum: ['clarity', 'specificity', 'context', 'all'],
            description: 'Type of enhancement (default: all)'
          }
        },
        required: ['prompt']
      },
      annotations: {
        title: 'Enhance Prompt',
        audience: ['user', 'assistant'],
        readOnlyHint: true,
        destructiveHint: false,
        idempotentHint: true,
        openWorldHint: false
      }
    };
  • src/index.ts:73-203 (registration)
    Registration of the enhancePromptDefinition in the tools list (line 136) for discovery via listTools, import at line 73, and handler mapping at line 203 for execution dispatch.
    import { enhancePromptDefinition, enhancePrompt } from './tools/prompt/enhancePrompt.js';
    import { analyzePromptDefinition, analyzePrompt } from './tools/prompt/analyzePrompt.js';
    import { enhancePromptGeminiDefinition, enhancePromptGemini } from './tools/prompt/enhancePromptGemini.js';
    
    // Reasoning
    import { applyReasoningFrameworkDefinition, applyReasoningFramework } from './tools/reasoning/applyReasoningFramework.js';
    
    // UI & Analytics
    import { previewUiAsciiDefinition, previewUiAscii } from './tools/ui/previewUiAscii.js';
    import { getUsageAnalyticsDefinition, getUsageAnalytics } from './tools/analytics/getUsageAnalytics.js';
    
    // ============================================================================
    // TOOL REGISTRY - Clean, Organized, Easy to Maintain
    // ============================================================================
    
    const tools = [
      // Core Utilities (2)
      getCurrentTimeDefinition,
      previewUiAsciiDefinition,
    
      // Memory Management - Basic (6)
      saveMemoryDefinition,
      recallMemoryDefinition,
      updateMemoryDefinition,
      deleteMemoryDefinition,
      listMemoriesDefinition,
      prioritizeMemoryDefinition,
    
      // Memory Management - Graph (4) - v2.0 NEW
      linkMemoriesDefinition,
      getMemoryGraphDefinition,
      searchMemoriesAdvancedDefinition,
      createMemoryTimelineDefinition,
    
      // Memory Management - Session Context (1) - v2.1 NEW
      getSessionContextDefinition,
    
      // Code Analysis - Semantic (2)
      findSymbolDefinition,
      findReferencesDefinition,
    
      // Code Analysis - Advanced (1) - v2.0 NEW
      analyzeDependencyGraphDefinition,
    
      // Code Quality (6)
      getCodingGuideDefinition,
      applyQualityRulesDefinition,
      validateCodeQualityDefinition,
      analyzeComplexityDefinition,
      checkCouplingCohesionDefinition,
      suggestImprovementsDefinition,
    
      // Thinking & Planning (8)
      createThinkingChainDefinition,
      analyzeProblemDefinition,
      stepByStepAnalysisDefinition,
      formatAsPlanDefinition,
      generatePrdDefinition,
      createUserStoriesDefinition,
      analyzeRequirementsDefinition,
      featureRoadmapDefinition,
    
      // Prompt Engineering (3)
      enhancePromptDefinition,
      analyzePromptDefinition,
      enhancePromptGeminiDefinition,
    
      // Reasoning (1)
      applyReasoningFrameworkDefinition,
    
      // Analytics (1) - v2.0 NEW
      getUsageAnalyticsDefinition
    ];
    
    // Total: 35 tools (v2.1: +1 get_session_context)
    
    // ============================================================================
    // TOOL HANDLER REGISTRY - Dynamic Dispatch Pattern (No Switch Statement)
    // ============================================================================
    
    type ToolHandler = (args: any) => Promise<CallToolResult>;
    
    const toolHandlers: Record<string, ToolHandler> = {
      // Time & UI
      'get_current_time': getCurrentTime,
      'preview_ui_ascii': previewUiAscii,
    
      // Memory - Basic
      'save_memory': saveMemory,
      'recall_memory': recallMemory,
      'update_memory': updateMemory,
      'delete_memory': deleteMemory,
      'list_memories': listMemories,
      'prioritize_memory': prioritizeMemory,
    
      // Memory - Graph (v2.0 NEW)
      'link_memories': linkMemories,
      'get_memory_graph': getMemoryGraph,
      'search_memories_advanced': searchMemoriesAdvanced,
      'create_memory_timeline': createMemoryTimeline,
    
      // Memory - Session Context (v2.1 NEW)
      'get_session_context': getSessionContext,
    
      // Code Analysis
      'find_symbol': findSymbol,
      'find_references': findReferences,
      'analyze_dependency_graph': analyzeDependencyGraph,
    
      // Code Quality
      'get_coding_guide': getCodingGuide,
      'apply_quality_rules': applyQualityRules,
      'validate_code_quality': validateCodeQuality,
      'analyze_complexity': analyzeComplexity,
      'check_coupling_cohesion': checkCouplingCohesion,
      'suggest_improvements': suggestImprovements,
    
      // Thinking
      'create_thinking_chain': createThinkingChain,
      'analyze_problem': analyzeProblem,
      'step_by_step_analysis': stepByStepAnalysis,
      'format_as_plan': formatAsPlan,
    
      // Planning
      'generate_prd': generatePrd,
      'create_user_stories': createUserStories,
      'analyze_requirements': analyzeRequirements,
      'feature_roadmap': featureRoadmap,
    
      // Prompt
      'enhance_prompt': enhancePrompt,
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description adds minimal behavioral context beyond what annotations provide. Annotations already indicate this is a read-only, non-destructive, idempotent operation with a closed-world scope. The description doesn't contradict these annotations, but only adds that it transforms 'vague requests' - which is essentially restating the tool's purpose rather than providing additional behavioral details like rate limits, authentication needs, or transformation specifics.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise and front-loaded with relevant keywords. It uses a pipe-separated format to list synonyms and transformation goals efficiently, then adds a brief purpose statement. Every element serves a purpose without redundancy, making it easy to scan and understand quickly.

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?

For a transformation tool with good annotations (read-only, idempotent, non-destructive) and comprehensive parameter documentation, the description provides adequate but minimal context. It states what the tool does but lacks information about output format, transformation methodology, or quality of enhancements. Without an output schema, the description could benefit from mentioning what kind of enhanced prompt to expect, but it meets minimum viability given the structured data coverage.

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?

With 100% schema description coverage, the input schema already documents all three parameters thoroughly. The description doesn't add any meaningful parameter semantics beyond what's in the schema - it doesn't explain how the 'enhancement_type' choices affect the transformation, how 'context' influences the enhancement, or provide examples of prompt transformations. The baseline of 3 is appropriate given the comprehensive schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/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: transforming vague requests into more specific, detailed, or clarified versions. It lists specific transformation goals (clarity, specificity, context) and provides synonyms for 'enhance' (be specific, more detail, clarify, elaborate). However, it doesn't explicitly differentiate from its sibling 'enhance_prompt_gemini', which appears to be a similar tool.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. While it mentions what the tool does, it doesn't indicate when it's appropriate to use versus other prompt-related tools like 'analyze_prompt', 'suggest_improvements', or its sibling 'enhance_prompt_gemini'. There's no mention of prerequisites, typical use cases, or comparison with similar tools.

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/su-record/hi-ai'

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