Skip to main content
Glama

retrieve_agent

Retrieve complete details for a specific agent by ID to access its full operational state and configuration within the Letta system.

Instructions

Get the full state of a specific agent by ID. Similar to get_agent_summary but returns complete details. Use list_agents to find agent IDs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
agent_idYesThe ID of the agent to retrieve

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes
nameYes
modelNo
toolsNo
memoryNo
created_atNo
descriptionNo
embedding_modelNo

Implementation Reference

  • The main handler function that implements the logic for the 'retrieve_agent' tool. It fetches the full state of an agent by ID using the server's API and returns it as JSON text content.
    export async function handleRetrieveAgent(server, args) {
        if (!args?.agent_id) {
            server.createErrorResponse('Missing required argument: agent_id');
        }
    
        try {
            const headers = server.getApiHeaders();
            const agentId = encodeURIComponent(args.agent_id);
    
            // Use the specific endpoint from the OpenAPI spec
            const response = await server.api.get(`/agents/${agentId}`, { headers });
            const agentState = response.data; // Assuming response.data is the AgentState object
    
            return {
                content: [
                    {
                        type: 'text',
                        text: JSON.stringify({
                            agent: agentState,
                        }),
                    },
                ],
            };
        } catch (error) {
            // Handle potential 404 if agent not found, or other API errors
            if (error.response && error.response.status === 404) {
                server.createErrorResponse(`Agent not found: ${args.agent_id}`);
            }
            server.createErrorResponse(error);
        }
    }
  • The tool definition including name, description, and input schema for 'retrieve_agent'.
    export const retrieveAgentDefinition = {
        name: 'retrieve_agent',
        description:
            'Get the full state of a specific agent by ID. Similar to get_agent_summary but returns complete details. Use list_agents to find agent IDs.',
        inputSchema: {
            type: 'object',
            properties: {
                agent_id: {
                    type: 'string',
                    description: 'The ID of the agent to retrieve',
                },
            },
            required: ['agent_id'],
        },
    };
  • Switch case in the tool call handler that routes 'retrieve_agent' calls to the handleRetrieveAgent function.
    case 'retrieve_agent':
        return handleRetrieveAgent(server, request.params.arguments);
  • Inclusion of retrieveAgentDefinition in the allTools array used to register tool definitions with the MCP server.
    retrieveAgentDefinition,
  • src/tools/index.js:6-6 (registration)
    Import of the handler and definition for 'retrieve_agent'.
    import { handleRetrieveAgent, retrieveAgentDefinition } from './agents/retrieve-agent.js';
Behavior3/5

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

Annotations provide a title ('Get Agent Details') but no behavioral hints like readOnlyHint or destructiveHint. The description adds value by clarifying that this retrieves 'full state' and 'complete details', which suggests a comprehensive read operation. However, it doesn't disclose other behavioral traits like error conditions, rate limits, or authentication requirements, leaving some gaps.

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 highly concise and well-structured with two sentences: the first states the purpose and differentiation, and the second provides usage guidance. Every sentence earns its place by adding critical information without redundancy, making it front-loaded and efficient.

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 low complexity (single parameter, read-only operation implied), high schema coverage (100%), and the presence of an output schema (which handles return values), the description is complete enough. It covers purpose, differentiation, and prerequisites, addressing all necessary contextual aspects without overloading.

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%, with the single parameter 'agent_id' fully documented in the schema. The description doesn't add any parameter-specific details beyond what the schema provides, such as format examples or constraints. Given the high schema coverage, the baseline score of 3 is appropriate as the description doesn't compensate but doesn't need to.

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 verb ('Get') and resource ('full state of a specific agent by ID'), making the purpose explicit. It also distinguishes this tool from its sibling 'get_agent_summary' by specifying that it returns 'complete details' instead of a summary, providing clear differentiation.

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

Usage Guidelines5/5

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

The description provides explicit guidance on when to use this tool vs. alternatives: it names 'get_agent_summary' as a sibling with different output detail and 'list_agents' as a prerequisite for finding agent IDs. This covers both when-to-use and when-not-to-use scenarios effectively.

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