Skip to main content
Glama

get_ai_guidance

Provides structured guidance for MCP server development with deterministic recommendations and working code patterns based on specified topics.

Instructions

Get structured guidance for MCP server development.

IMPORTANT NOTES:
- AI sampling (ctx.sample) is NOT currently supported in Claude Desktop
- Use modern typing: dict, list, str | None instead of Dict, List, Optional
- Always implement proper process cleanup and signal handling
- Follow MCP SDK patterns for tools, resources, and prompts

This tool provides structured, deterministic guidance instead of AI-generated content.
For dynamic AI assistance, use Claude Desktop's built-in capabilities directly.

Args:
    topic: Topic to get guidance on (best_practices, security, performance, typing, etc.)
    server_type: Type of server for contextualized advice

Returns:
    Structured guidance and recommendations with working code patterns

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
topicYes
server_typeNogeneral

Implementation Reference

  • main.py:165-246 (handler)
    The handler function decorated with @mcp.tool(), implementing and registering the 'get_ai_guidance' tool. It returns hardcoded structured guidance for MCP server development topics.
    @mcp.tool()
    async def get_ai_guidance(
        ctx: Context,
        topic: str,
        server_type: str = "general",
    ) -> str:
        """
        Get structured guidance for MCP server development.
    
        IMPORTANT NOTES:
        - AI sampling (ctx.sample) is NOT currently supported in Claude Desktop
        - Use modern typing: dict, list, str | None instead of Dict, List, Optional
        - Always implement proper process cleanup and signal handling
        - Follow MCP SDK patterns for tools, resources, and prompts
    
        This tool provides structured, deterministic guidance instead of AI-generated content.
        For dynamic AI assistance, use Claude Desktop's built-in capabilities directly.
    
        Args:
            topic: Topic to get guidance on (best_practices, security, performance, typing, etc.)
            server_type: Type of server for contextualized advice
    
        Returns:
            Structured guidance and recommendations with working code patterns
        """
        try:
            guidance_prompt = f"""
            Provide comprehensive guidance for MCP server development on the topic: {topic}
            Context: Creating a {server_type} MCP server
    
            Please include:
            1. Key best practices
            2. Common pitfalls to avoid
            3. Security considerations
            4. Performance optimization tips
            5. Specific recommendations for this server type
    
            Format the response clearly with actionable advice.
            """
    
            # Note: AI sampling is not currently supported in Claude Desktop
            # Providing structured guidance template instead
            guidance = f"""
            ## MCP Server Development Guidance - {topic.title()}
    
            ### Best Practices for {server_type} servers:
            1. **Process Management**: Implement signal handlers and cleanup functions
            2. **Error Handling**: Use try/catch blocks with meaningful error messages
            3. **Security**: Validate all inputs and sanitize data
            4. **Performance**: Use async/await patterns and connection pooling
            5. **Logging**: Log to stderr for MCP compliance
    
            ### Common Pitfalls:
            - Missing process cleanup leading to resource leaks
            - Blocking operations without async/await
            - Inadequate input validation
            - Poor error messages that don't help debugging
    
            ### Security Considerations:
            - Always validate and sanitize user inputs
            - Implement rate limiting for resource-intensive operations
            - Use environment variables for sensitive configuration
            - Follow principle of least privilege
    
            ### Performance Tips:
            - Cache expensive operations when possible
            - Use connection pooling for databases
            - Implement proper timeouts
            - Monitor resource usage
    
            ### Specific Recommendations for {server_type}:
            - Follow existing patterns in the MCP-Creator templates
            - Test with small inputs before scaling
            - Implement graceful degradation for failures
            - Document your API clearly
            """
            return f"🧠 AI Guidance - {topic.title()}:\n\n{guidance}"
    
        except Exception as e:
            logger.error(f"Failed to get AI guidance for topic '{topic}': {e}")
            return f"❌ Error getting guidance: {str(e)}"
  • main.py:165-165 (registration)
    The @mcp.tool() decorator registers the get_ai_guidance function as an MCP tool.
    @mcp.tool()

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/angrysky56/mcp-creator-mcp'

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