Skip to main content
Glama

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
NameRequiredDescriptionDefault
block_idYesID of the memory block to retrieve
agent_idNoOptional agent ID for authorization

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes
nameYes
labelYes
valueYes
metadataNo

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'],
        },
    };
  • 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'],
    },
  • Registration of the handler in the main tool call switch statement within registerToolHandlers.
    case 'read_memory_block':
        return handleReadMemoryBlock(server, request.params.arguments);
  • Import of the handler and tool definition from the implementation file.
        handleReadMemoryBlock,
        readMemoryBlockToolDefinition,
    } from './memory/read-memory-block.js';
  • 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',
    },
Behavior3/5

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

Annotations are minimal (only a title), so the description carries most of the burden. It implies this is a read operation ('Get full details'), which aligns with the tool name 'read_memory_block', but doesn't explicitly state whether it's safe, requires specific permissions, or has rate limits. It adds some context about dependencies (list_memory_blocks for IDs) but lacks detailed behavioral traits beyond the basic operation.

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 front-loaded with the core purpose in the first sentence, followed by two concise sentences providing usage guidelines. Every sentence adds value without redundancy, making it efficient and well-structured for quick understanding.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (read operation with 2 parameters), high schema coverage, and the presence of an output schema (which handles return values), the description is largely complete. It covers purpose, prerequisites, and next steps. However, it could benefit from more behavioral context (e.g., error handling or permissions), keeping it from a perfect score.

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 clear descriptions for both parameters (block_id and optional agent_id). The description doesn't add any additional meaning beyond what the schema provides, such as format examples or authorization details for agent_id. With high schema coverage, the baseline score of 3 is appropriate as the description doesn't compensate with extra insights.

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 specific action ('Get full details') and resource ('a specific memory block by ID'), distinguishing it from siblings like list_memory_blocks (which lists blocks) and update_memory_block (which modifies blocks). It explicitly identifies the target resource and operation.

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 ('to find block IDs, use list_memory_blocks') and what to do after reading ('use update_memory_block to modify content'). It clearly differentiates this tool from its siblings by specifying prerequisites and next steps.

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