Skip to main content
Glama
iKwesi

Tavily Web Search MCP Server

by iKwesi

ask_specialized_claude

Access specialized Claude AI personas for targeted tasks like code review, text summarization, educational explanations, creative writing, and general assistance through the Tavily Web Search MCP Server.

Instructions

Call a specialized Claude model for targeted reasoning tasks.

This is "meta-AI" - Claude in Cursor calling another Claude instance with specialized system prompts for specific tasks. Each task_type activates a different Claude persona optimized for that use case.

Args: prompt: User input for Claude to process task_type: Specialization mode, one of: - code_review: Security and quality code analysis - summarize: Concise text summarization - explain: Educational explanations (ELI5 style) - creative: Creative writing and ideation - general: General-purpose assistance max_tokens: Response length cap (default 1024, max 4096)

Returns: A formatted string response from the specialized Claude instance

Examples: >>> ask_specialized_claude("Explain quantum computing", "explain") >>> ask_specialized_claude("Review this code: def foo()...", "code_review") >>> ask_specialized_claude("Summarize this article...", "summarize")

Raises: ValueError: If task_type is not recognized Exception: If API call fails (network, auth, rate limit, etc.)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
promptYes
task_typeNogeneral
max_tokensNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The core handler function for the 'ask_specialized_claude' tool. It validates inputs, selects the appropriate Claude profile, calls the Anthropic API with a specialized system prompt, formats the response, and handles errors.
    @mcp.tool(name="ask_specialized_claude")
    def ask_specialized_claude(
        prompt: str, 
        task_type: str = "general", 
        max_tokens: int = 1024
    ) -> str:
        """
        Call a specialized Claude model for targeted reasoning tasks.
        
        This is "meta-AI" - Claude in Cursor calling another Claude instance
        with specialized system prompts for specific tasks. Each task_type
        activates a different Claude persona optimized for that use case.
        
        Args:
            prompt: User input for Claude to process
            task_type: Specialization mode, one of:
                - code_review: Security and quality code analysis
                - summarize: Concise text summarization
                - explain: Educational explanations (ELI5 style)
                - creative: Creative writing and ideation
                - general: General-purpose assistance
            max_tokens: Response length cap (default 1024, max 4096)
        
        Returns:
            A formatted string response from the specialized Claude instance
            
        Examples:
            >>> ask_specialized_claude("Explain quantum computing", "explain")
            >>> ask_specialized_claude("Review this code: def foo()...", "code_review")
            >>> ask_specialized_claude("Summarize this article...", "summarize")
        
        Raises:
            ValueError: If task_type is not recognized
            Exception: If API call fails (network, auth, rate limit, etc.)
        """
        
        # Validate task_type
        if task_type not in CLAUDE_PROFILES:
            valid = ", ".join(CLAUDE_PROFILES.keys())
            raise ValueError(
                f"Invalid task_type '{task_type}'. Must be one of: {valid}"
            )
        
        # Validate max_tokens
        if not (1 <= max_tokens <= 4096):
            raise ValueError(
                f"max_tokens must be between 1 and 4096, got {max_tokens}"
            )
        
        # Get the profile for this task type
        profile = CLAUDE_PROFILES[task_type]
        
        # Get cached Anthropic client
        try:
            client = get_anthropic_client()
        except EnvironmentError as e:
            return f"❌ Configuration Error: {str(e)}"
        
        try:
            # Call Claude with specialized system prompt
            response = client.messages.create(
                model="claude-sonnet-4-20250514",  # Latest Claude model
                system=profile["system"],
                max_tokens=max_tokens,
                messages=[{"role": "user", "content": prompt}],
            )
            
            # Extract response text
            text = response.content[0].text.strip() if response.content else "[No content returned]"
            
            # Format with header showing which mode was used
            header = f"🤖 Specialized Claude ({task_type.replace('_', ' ').title()} Mode)"
            separator = "─" * len(header)
            
            return f"{header}\n{separator}\n\n{text}"
        
        except Exception as e:
            # Provide helpful error messages
            error_msg = str(e)
            
            # Check for common error types
            if "rate_limit" in error_msg.lower():
                return (
                    f"❌ Rate Limit Error: Too many requests to Claude API.\n"
                    f"Please wait a moment and try again."
                )
            elif "authentication" in error_msg.lower() or "api_key" in error_msg.lower():
                return (
                    f"❌ Authentication Error: Invalid ANTHROPIC_API_KEY.\n"
                    f"Please check your .env file and verify your API key."
                )
            elif "timeout" in error_msg.lower():
                return (
                    f"❌ Timeout Error: Request to Claude API timed out.\n"
                    f"Please try again."
                )
            else:
                return (
                    f"❌ Error invoking Claude ({task_type}): {error_msg}\n\n"
                    f"If this persists, check your API key and network connection."
                )
  • Schema defining the specialized Claude profiles, including system prompts and descriptions for each task_type. Used for input validation and to configure specialized behavior.
    # Declarative profile map - keeps logic clean and DRY
    # Each profile defines a specialized Claude persona with:
    # - system: The system prompt that shapes Claude's behavior
    # - description: Human-readable explanation of the profile's purpose
    CLAUDE_PROFILES = {
        "code_review": {
            "system": (
                "You are a senior software engineer specializing in code "
                "security, performance, and maintainability. Identify "
                "vulnerabilities, inefficiencies, and best practice violations "
                "clearly and concisely. Focus on actionable feedback."
            ),
            "description": "Performs detailed code and security reviews with actionable feedback."
        },
        "summarize": {
            "system": (
                "You are a precise summarizer. Extract key insights, remove "
                "redundancy, and produce clear, short summaries. Focus on "
                "the most important information and maintain accuracy."
            ),
            "description": "Summarizes text accurately and briefly, preserving key insights."
        },
        "explain": {
            "system": (
                "You are an educator specializing in making complex topics simple. "
                "Explain concepts for beginners using analogies, progressive "
                "explanations, and clear examples. Avoid jargon unless necessary."
            ),
            "description": "Explains complex topics in simple, beginner-friendly terms."
        },
        "creative": {
            "system": (
                "You are a creative writer. Generate imaginative, engaging, "
                "and original ideas with vivid language. Think outside the box "
                "and surprise the user with creative perspectives."
            ),
            "description": "Creative writing and ideation with imaginative perspectives."
        },
        "general": {
            "system": (
                "You are a helpful, knowledgeable AI assistant. Provide clear, "
                "accurate, and useful responses. Be concise but thorough."
            ),
            "description": "General-purpose reasoning and assistance."
        },
    }
  • server.py:31-34 (registration)
    Import statement in the main server.py that triggers the self-registration of the ask_specialized_claude tool via its @mcp.tool decorator.
    # ✅ ACTIVE: Specialized Claude (Meta-AI)
    
    import tools.anthropic_tools
Behavior4/5

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

With no annotations provided, the description carries full burden and does well. It discloses this is 'meta-AI' (Claude calling Claude), mentions different personas per task_type, includes error handling details (raises ValueError for unrecognized task_type, Exception for API failures), and describes the return format. It doesn't mention rate limits or auth specifics, but covers key behavioral aspects.

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 well-structured and appropriately sized. It starts with a clear purpose statement, explains the meta-AI concept, details parameters with examples, and covers returns and errors. Every sentence adds value with zero waste, and it's front-loaded with the most important information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (AI calling AI with multiple specializations), no annotations, and 0% schema coverage, the description is remarkably complete. It explains the tool's unique nature, all parameters thoroughly, provides examples, documents return values and errors. With an output schema present, it doesn't need to explain return format details, making this description comprehensive for its context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the description fully compensates by explaining all 3 parameters. It defines 'prompt' as 'User input for Claude to process', lists all valid 'task_type' values with their purposes, and explains 'max_tokens' as 'Response length cap' with default and maximum values. This adds significant meaning beyond the bare schema.

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

Purpose5/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: 'Call a specialized Claude model for targeted reasoning tasks.' It specifies the verb ('Call'), resource ('specialized Claude model'), and distinguishes it from sibling tools (roll_dice, web_search) by focusing on AI reasoning rather than random generation or web search.

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

Usage Guidelines4/5

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

The description provides clear context for when to use this tool: for 'targeted reasoning tasks' with different 'task_type' specializations. It doesn't explicitly state when NOT to use it or name alternatives among siblings, but the specialization context is well-defined.

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/iKwesi/AIE8-MCP-Session'

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