Skip to main content
Glama

enhance_prompt

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,

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