read_memory_block
Retrieve full details of a specific memory block by its ID to access stored information in the Letta system.
Instructions
Get full details of a specific memory block by ID. Use list_memory_blocks to find block IDs. After reading, use update_memory_block to modify content.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| block_id | Yes | ID of the memory block to retrieve | |
| agent_id | No | Optional agent ID for authorization |
Implementation Reference
- The main handler function that validates input arguments, fetches the memory block via API call to `/blocks/${block_id}`, formats the response as MCP content, and handles errors.export async function handleReadMemoryBlock(server, args) { try { // Validate arguments if (!args?.block_id) { throw new Error('Missing required argument: block_id'); } // Headers for API requests const headers = server.getApiHeaders(); // If agent_id is provided, set the user_id header if (args.agent_id) { headers['user_id'] = args.agent_id; } // Get the memory block const response = await server.api.get(`/blocks/${args.block_id}`, { headers, }); // Format the response return { content: [ { type: 'text', text: JSON.stringify(response.data), }, ], }; } catch (error) { server.createErrorResponse(error); } }
- Tool definition including input schema for block_id (required) and optional agent_id.export const readMemoryBlockToolDefinition = { name: 'read_memory_block', description: 'Get full details of a specific memory block by ID. Use list_memory_blocks to find block IDs. After reading, use update_memory_block to modify content.', inputSchema: { type: 'object', properties: { block_id: { type: 'string', description: 'ID of the memory block to retrieve', }, agent_id: { type: 'string', description: 'Optional agent ID for authorization', }, }, required: ['block_id'], }, };
- src/tools/output-schemas.js:450-460 (schema)Output schema defining the structure of the memory block response (id, name, label, value, metadata).read_memory_block: { type: 'object', properties: { id: { type: 'string' }, name: { type: 'string' }, label: { type: 'string' }, value: { type: 'string' }, metadata: { type: 'object' }, }, required: ['id', 'name', 'label', 'value'], },
- src/tools/index.js:165-166 (registration)Registration of the handler in the main tool call switch statement within registerToolHandlers.case 'read_memory_block': return handleReadMemoryBlock(server, request.params.arguments);
- src/tools/index.js:21-23 (registration)Import of the handler and tool definition from the implementation file.handleReadMemoryBlock, readMemoryBlockToolDefinition, } from './memory/read-memory-block.js';
- src/tools/annotations.js:89-95 (helper)Annotations providing metadata about the tool's behavior (read-only, auth required, low cost, fast execution).read_memory_block: { title: 'Read Memory Block', readOnly: true, requiresAuth: true, costLevel: 'low', executionTime: 'fast', },