Skip to main content
Glama

use_prompt

Execute registered prompt templates to run wizards, workflows, and guided interactions in the Letta system.

Instructions

Execute a registered prompt template. Use this to run wizards, workflows, and guided interactions.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
prompt_nameYesName of the prompt to execute (e.g., letta_agent_wizard, letta_memory_optimizer)
argumentsNoArguments to pass to the prompt (depends on the specific prompt)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
messagesYesMessages returned by the prompt
descriptionNoDescription of the prompt
prompt_nameYesName of the executed prompt

Implementation Reference

  • The main handler function for the 'use_prompt' tool. It retrieves a registered prompt by name from the promptRegistry, executes it with provided arguments, and returns the resulting messages in both text and structured content formats.
    export async function handleUsePrompt(server, args) {
        try {
            const { prompt_name, arguments: promptArgs } = args;
    
            if (!prompt_name) {
                throw new Error('Missing required parameter: prompt_name');
            }
    
            // Get the prompt from registry
            const prompt = promptRegistry.get(prompt_name);
            if (!prompt) {
                // List available prompts for helpful error
                const availablePrompts = Array.from(promptRegistry.keys());
                throw new Error(
                    `Prompt not found: ${prompt_name}. Available prompts: ${availablePrompts.join(', ')}`,
                );
            }
    
            // Execute the prompt handler
            const messages = await prompt.handler(promptArgs || {});
    
            return {
                content: [
                    {
                        type: 'text',
                        text: JSON.stringify(
                            {
                                prompt_name,
                                description: prompt.description,
                                messages: messages.length,
                                preview: messages[0]?.content?.text?.substring(0, 200) + '...',
                            },
                            null,
                            2,
                        ),
                    },
                ],
                structuredContent: {
                    prompt_name,
                    description: prompt.description,
                    messages,
                },
            };
        } catch (error) {
            return server.createErrorResponse(error, 'Failed to execute prompt');
        }
    }
  • The tool definition object for 'use_prompt', including detailed inputSchema (requiring prompt_name and optional arguments) and outputSchema (including prompt details and messages).
    export const usePromptToolDefinition = {
        name: 'use_prompt',
        description:
            'Execute a registered prompt template. Use this to run wizards, workflows, and guided interactions.',
        inputSchema: {
            type: 'object',
            properties: {
                prompt_name: {
                    type: 'string',
                    description:
                        'Name of the prompt to execute (e.g., letta_agent_wizard, letta_memory_optimizer)',
                },
                arguments: {
                    type: 'object',
                    description: 'Arguments to pass to the prompt (depends on the specific prompt)',
                    additionalProperties: true,
                },
            },
            required: ['prompt_name'],
        },
        outputSchema: {
            type: 'object',
            properties: {
                prompt_name: {
                    type: 'string',
                    description: 'Name of the executed prompt',
                },
                description: {
                    type: 'string',
                    description: 'Description of the prompt',
                },
                messages: {
                    type: 'array',
                    items: {
                        type: 'object',
                        properties: {
                            role: { type: 'string' },
                            content: { type: 'object' },
                        },
                    },
                    description: 'Messages returned by the prompt',
                },
            },
            required: ['prompt_name', 'messages'],
        },
    };
  • Registration of the 'use_prompt' tool handler in the central switch statement within the CallToolRequestSchema handler, dispatching calls to handleUsePrompt.
    case 'use_prompt':
        return handleUsePrompt(server, request.params.arguments);
  • Inclusion of usePromptToolDefinition in the allTools array for registration with the MCP server.
    usePromptToolDefinition,
  • Import of the handler function and tool definition from the implementation file.
    import { handleUsePrompt, usePromptToolDefinition } from './prompts/use-prompt.js';
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool executes prompts but lacks details on permissions, side effects, rate limits, or response format. This is inadequate for a tool that likely involves complex interactions, leaving 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.

Conciseness5/5

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

The description is extremely concise with two short sentences that are front-loaded and waste no words. Every sentence directly contributes to understanding the tool's purpose, making it efficient and well-structured.

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 (executing prompts with arguments) and the presence of an output schema, the description is minimally adequate. However, with no annotations and incomplete behavioral context, it falls short of being fully complete for safe and effective use by an AI agent.

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 both parameters thoroughly. The description adds no additional meaning beyond implying that 'prompt_name' refers to registered templates and 'arguments' are prompt-specific, which is minimal value over the schema's detailed descriptions.

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 action ('Execute') and resource ('registered prompt template'), with specific examples of what types of prompts can be run ('wizards, workflows, and guided interactions'). However, it doesn't explicitly differentiate from sibling tools like 'prompt_agent' or 'list_prompts', which limits the score.

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 like 'prompt_agent' or 'list_prompts'. It mentions what the tool does but offers no context on prerequisites, exclusions, or comparative use cases with sibling tools.

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/oculairmedia/Letta-MCP-server'

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