Skip to main content
Glama

generate_meta_prompt

Create structured meta-prompts for AI tasks by analyzing requirements and selecting appropriate reasoning frameworks to improve response quality.

Instructions

Generate an optimized meta-prompt for the given task.

Analyzes the task, selects the best reasoning framework (or uses the specified one), and generates a structured prompt designed to elicit high-quality reasoning.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
taskYesThe task or question to create a prompt for
contextNoAdditional context to include in the prompt
frameworkNoSpecific framework to use (optional, auto-selects if not provided)
persistNoWhether to log this generation for analytics

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The function 'generate_meta_prompt' acts as the primary handler for the MCP tool, orchestrating task analysis, meta-prompt construction, and optional persistence.
    def generate_meta_prompt(
        task: Annotated[str, "The task or question to create a prompt for"],
        context: Annotated[str, "Additional context to include in the prompt"] = "",
        framework: Annotated[Optional[str], "Specific framework to use (optional, auto-selects if not provided)"] = None,
        persist: Annotated[bool, "Whether to log this generation for analytics"] = True,
    ) -> dict:
        """
        Generate an optimized meta-prompt for the given task.
        
        Analyzes the task, selects the best reasoning framework (or uses the specified one),
        and generates a structured prompt designed to elicit high-quality reasoning.
        """
        deps = get_dependencies()
        
        # Analyze task
        analysis = deps.selector.analyze(task, context)
        
        # Build prompt (use override framework if specified)
        result = deps.builder.build(
            task=task,
            context=context,
            framework_name=framework,
            analysis=analysis,
        )
        
        # Persist if requested
        log_id = None
        if persist:
            log_data = ReasoningLogCreate(
                task_input=task,
                context=context if context else None,
                detected_category=analysis.category.value,
                complexity_score=analysis.complexity_score,
                selected_framework=result.framework_used,
                meta_prompt_generated=result.meta_prompt,
            )
            log = deps.storage.create_log(log_data)
            log_id = str(log.id)
        
        return {
            "task_id": log_id,
            "framework_used": result.framework_used,
            "analysis": {
                "category": analysis.category.value,
                "complexity_score": analysis.complexity_score,
                "complexity_level": analysis.complexity_level.value,
            },
            "meta_prompt": result.meta_prompt,
        }
  • Tool registration using the '@mcp.tool()' decorator within the 'FastMCP' server instance.
    @mcp.tool()
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions analyzing tasks and generating structured prompts, but lacks details on permissions, rate limits, side effects, or what 'optimized' entails. For a tool with no annotation coverage, this leaves significant gaps in understanding its behavior.

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

Conciseness4/5

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

The description is concise and well-structured in two sentences. The first sentence states the core purpose, and the second elaborates on the process. There's no wasted text, though it could be slightly more front-loaded with key details.

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?

Given the tool's complexity (generating prompts with frameworks) and the presence of an output schema, the description is moderately complete. It covers the purpose but lacks behavioral details and usage guidelines. With no annotations and incomplete contextual guidance, it's adequate but has clear gaps.

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?

Schema description coverage is 100%, so the schema already documents all parameters thoroughly. The description adds minimal value beyond the schema, mentioning 'task' and 'framework' implicitly but not explaining their semantics further. With high schema coverage, the baseline score of 3 is appropriate.

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: 'Generate an optimized meta-prompt for the given task.' It specifies the verb ('generate') and resource ('optimized meta-prompt'), and mentions analyzing tasks and selecting reasoning frameworks. However, it doesn't explicitly differentiate from sibling tools like 'recommend_strategy' which might have overlapping functionality.

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. It doesn't mention sibling tools like 'list_available_frameworks' or 'recommend_strategy', nor does it specify prerequisites or contexts where this tool is preferred. Usage is implied but not explicitly stated.

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/BlinkVoid/PromptSmith'

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