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

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';

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