Skip to main content
Glama

Smart Prompts MCP Server

test-workflow-guidance.jsโ€ข3.58 kB
// Test the enhanced workflow guidance and error handling import { EnhancedPromptTools } from './dist/enhancedTools.js'; import { EnhancedPromptCache } from './dist/enhancedCache.js'; import { EnhancedGitHubPromptFetcher } from './dist/github-enhanced.js'; import { loadConfig } from './dist/config.js'; async function testWorkflowGuidance() { console.log('๐Ÿงช Testing Enhanced Workflow Guidance...\n'); const config = loadConfig(); const fetcher = new EnhancedGitHubPromptFetcher(config.github); const cache = new EnhancedPromptCache(fetcher, config); const tools = new EnhancedPromptTools(config.github, cache); try { await cache.initialize(); // Test 1: Help with workflow topic console.log('๐Ÿ“š Testing workflow help...'); const workflowHelp = await tools.handleToolCall({ params: { name: 'prompts_help', arguments: { topic: 'workflow' } } }); console.log('โœ“ Workflow help includes step-by-step guidance'); // Test 2: Enhanced search descriptions console.log('\n๐Ÿ” Testing search tool descriptions...'); const toolDefs = tools.getToolDefinitions(); const searchTool = toolDefs.tools.find(t => t.name === 'search_prompts'); if (searchTool?.description.includes('ALWAYS START HERE')) { console.log('โœ“ Search tool emphasizes starting workflow'); } // Test 3: Get prompt with wrong name (should suggest alternatives) console.log('\nโŒ Testing error handling with wrong prompt name...'); try { await tools.handleToolCall({ params: { name: 'get_prompt', arguments: { name: 'nonexistent_prompt' } } }); } catch (error) { if (error.message.includes('Use search_prompts')) { console.log('โœ“ Error includes search guidance'); } } // Test 4: Get prompt with partial name (should suggest similar) console.log('\n๐Ÿ” Testing partial name suggestions...'); try { await tools.handleToolCall({ params: { name: 'get_prompt', arguments: { name: 'api' } } }); } catch (error) { if (error.message.includes('Did you mean')) { console.log('โœ“ Error suggests similar prompts'); } } // Test 5: Compose with missing prompts console.log('\n๐Ÿ”— Testing compose error handling...'); try { await tools.handleToolCall({ params: { name: 'compose_prompts', arguments: { prompts: ['missing_prompt'] } } }); } catch (error) { if (error.message.includes('Use search_prompts')) { console.log('โœ“ Compose error includes search guidance'); } } // Test 6: Create prompt tool description emphasizes search first const createTool = toolDefs.tools.find(t => t.name === 'create_github_prompt'); if (createTool?.description.includes('search_prompts first')) { console.log('\nโœจ Create tool emphasizes search-first workflow'); } console.log('\n๐ŸŽ‰ All workflow guidance tests passed!'); console.log('\n๐Ÿ“‹ **Key Improvements:**'); console.log(' โ€ข ๐Ÿ” Search tool labeled as starting point'); console.log(' โ€ข ๐Ÿ“– Get prompt requires exact names from search'); console.log(' โ€ข โœจ Create prompts warns to search first'); console.log(' โ€ข โŒ Errors include helpful suggestions'); console.log(' โ€ข ๐Ÿ“š Comprehensive workflow help topic'); console.log(' โ€ข ๐Ÿ”— Compose tool guides to search for names'); } catch (error) { console.error('โŒ Test failed:', error); } finally { await cache.cleanup(); } } testWorkflowGuidance().catch(console.error);

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/jezweb/smart-prompts-mcp'

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