Skip to main content
Glama

update_memory_block

Modify the content and metadata of a memory block in the Letta system by specifying its ID, enabling updates to stored information for agent operations.

Instructions

Update the contents and metadata of a memory block. Use list_memory_blocks to find block IDs, or read_memory_block to see current content before updating.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
block_idYesID of the memory block to update
valueNoNew value for the memory block (optional)
metadataNoNew metadata for the memory block (optional)
agent_idNoOptional agent ID for authorization

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
successYes
block_idYes
updated_fieldsNo

Implementation Reference

  • The handler function that implements the core logic for the 'update_memory_block' tool: validates inputs, prepares update data, makes a PATCH request to the Letta API to update the memory block, and returns the response.
    export async function handleUpdateMemoryBlock(server, args) {
        try {
            // Validate arguments
            if (!args?.block_id) {
                throw new Error('Missing required argument: block_id');
            }
    
            if (!args?.value && !args?.metadata) {
                throw new Error('Either value or metadata must be provided');
            }
    
            // 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;
            }
    
            // Prepare update data
            const updateData = {};
            if (args.value !== undefined) {
                updateData.value = args.value;
            }
            if (args.metadata !== undefined) {
                updateData.metadata = args.metadata;
            }
    
            // Update the memory block
            const response = await server.api.patch(`/blocks/${args.block_id}`, updateData, {
                headers,
            });
    
            // Format the response
            return {
                content: [
                    {
                        type: 'text',
                        text: JSON.stringify(response.data),
                    },
                ],
            };
        } catch (error) {
            server.createErrorResponse(error);
        }
    }
  • The tool definition including name, description, and input schema for 'update_memory_block'.
    export const updateMemoryBlockToolDefinition = {
        name: 'update_memory_block',
        description:
            'Update the contents and metadata of a memory block. Use list_memory_blocks to find block IDs, or read_memory_block to see current content before updating.',
        inputSchema: {
            type: 'object',
            properties: {
                block_id: {
                    type: 'string',
                    description: 'ID of the memory block to update',
                },
                value: {
                    type: 'string',
                    description: 'New value for the memory block (optional)',
                },
                metadata: {
                    type: 'object',
                    description: 'New metadata for the memory block (optional)',
                },
                agent_id: {
                    type: 'string',
                    description: 'Optional agent ID for authorization',
                },
            },
            required: ['block_id'],
        },
    };
  • Registration of the 'update_memory_block' handler in the central tool dispatch switch statement within registerToolHandlers.
    case 'update_memory_block':
        return handleUpdateMemoryBlock(server, request.params.arguments);
  • Import of the handler and tool definition for 'update_memory_block'.
        handleUpdateMemoryBlock,
        updateMemoryBlockToolDefinition,
    } from './memory/update-memory-block.js';
  • Inclusion of updateMemoryBlockToolDefinition in the allTools array used for registration.
    updateMemoryBlockToolDefinition,
Behavior3/5

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

Annotations only provide a title, so the description carries the burden of behavioral disclosure. It implies a mutation operation ('Update'), which is consistent with the tool name, but does not specify permissions, side effects, or response behavior. No contradictions with annotations exist, but it lacks details like whether updates are reversible or require specific auth beyond the optional agent_id parameter.

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 two sentences, front-loaded with the core purpose and followed by practical usage guidance. Every sentence adds value without redundancy, making it efficient and well-structured for quick comprehension.

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 has an output schema (not provided in context but indicated as present), the description need not detail return values. It covers purpose, usage guidelines, and prerequisites effectively. However, as a mutation tool with minimal annotations, it could benefit from more behavioral context (e.g., auth requirements or side effects), slightly reducing completeness.

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 fully documents all parameters. The description does not add any parameter-specific details beyond what the schema provides (e.g., it doesn't explain format for 'value' or 'metadata'). Baseline 3 is appropriate as the schema handles parameter documentation adequately.

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 action ('Update') and resource ('contents and metadata of a memory block'), distinguishing it from sibling tools like 'create_memory_block', 'delete_memory_block', 'read_memory_block', and 'list_memory_blocks'. It specifies both content and metadata updates, making the purpose specific and unambiguous.

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 explicitly provides when-to-use guidance by referencing sibling tools: 'Use list_memory_blocks to find block IDs, or read_memory_block to see current content before updating.' This clearly directs the agent to use alternatives for prerequisite steps, enhancing proper tool selection in context.

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