Skip to main content
Glama

modify_agent

Update an existing agent's configuration by ID, including name, system prompt, description, and other settings. Use to modify agent behavior and properties within the Letta system.

Instructions

Update an existing agent by ID with provided data. Use get_agent_summary to see current config, list_llm_models/list_embedding_models for model options. For tools, use attach_tool instead.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
agent_idYesThe ID of the agent to modify
update_dataYesAn object containing the fields to update (e.g., name, system, description, tool_ids, etc.)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
successYes
agent_idYes
updated_fieldsNo

Implementation Reference

  • The core handler function that executes the tool logic: validates arguments, makes a PATCH request to the /agents/{id} endpoint, and returns the updated agent state.
    export async function handleModifyAgent(server, args) {
        if (!args?.agent_id) {
            server.createErrorResponse('Missing required argument: agent_id');
        }
        if (!args?.update_data) {
            server.createErrorResponse('Missing required argument: update_data');
        }
    
        try {
            const headers = server.getApiHeaders();
            const agentId = encodeURIComponent(args.agent_id);
            const updatePayload = args.update_data; // This should conform to the UpdateAgent schema
    
            // Use the specific endpoint from the OpenAPI spec
            const response = await server.api.patch(`/agents/${agentId}`, updatePayload, { headers });
            const updatedAgentState = response.data; // Assuming response.data is the updated AgentState object
    
            return {
                content: [
                    {
                        type: 'text',
                        text: JSON.stringify({
                            agent: updatedAgentState,
                        }),
                    },
                ],
            };
        } catch (error) {
            // Handle potential 404 if agent not found, 422 for validation errors, or other API errors
            if (error.response) {
                if (error.response.status === 404) {
                    server.createErrorResponse(`Agent not found: ${args.agent_id}`);
                }
                if (error.response.status === 422) {
                    server.createErrorResponse(
                        `Validation error updating agent ${args.agent_id}: ${JSON.stringify(error.response.data)}`,
                    );
                }
            }
            server.createErrorResponse(error);
        }
    }
  • The tool definition object including name, description, and detailed inputSchema for validation.
    export const modifyAgentDefinition = {
        name: 'modify_agent',
        description:
            'Update an existing agent by ID with provided data. Use get_agent_summary to see current config, list_llm_models/list_embedding_models for model options. For tools, use attach_tool instead.',
        inputSchema: {
            type: 'object',
            properties: {
                agent_id: {
                    type: 'string',
                    description: 'The ID of the agent to modify',
                },
                update_data: {
                    type: 'object',
                    description:
                        'An object containing the fields to update (e.g., name, system, description, tool_ids, etc.)',
                    // Ideally, this would mirror the UpdateAgent schema from the API spec
                    // Example properties (add more as needed based on UpdateAgent schema):
                    properties: {
                        name: { type: 'string', description: 'New name for the agent' },
                        system: { type: 'string', description: 'New system prompt' },
                        description: { type: 'string', description: 'New description' },
                        // Add other updatable fields like tool_ids, source_ids, block_ids, tags, etc.
                    },
                    additionalProperties: true, // Allow other properties from UpdateAgent schema
                },
            },
            required: ['agent_id', 'update_data'],
        },
    };
  • Registration of the handler in the central tool call switch statement within registerToolHandlers.
    case 'modify_agent':
        return handleModifyAgent(server, request.params.arguments);
  • Inclusion of the tool definition in the allTools array for registration with the MCP server.
    modifyAgentDefinition,
  • Output schema definition for structured responses from the modify_agent tool.
    modify_agent: {
        type: 'object',
        properties: {
            success: { type: 'boolean' },
            agent_id: { type: 'string' },
            updated_fields: {
                type: 'array',
                items: { type: 'string' },
            },
        },
        required: ['success', 'agent_id'],
    },
Behavior3/5

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

Annotations only provide a title ('Modify Agent Configuration'), so the description carries the full burden. It correctly indicates this is a mutation operation ('Update'), but doesn't disclose behavioral traits like permission requirements, rate limits, or what happens to unspecified fields. The description adds some context about tool handling but lacks comprehensive behavioral details.

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 perfectly front-loaded with the core purpose in the first clause, followed by three concise usage guidelines. Every sentence earns its place by providing essential context without redundancy. The structure flows logically from what the tool does to how to use it properly.

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 this is a mutation tool with minimal annotations but an output schema exists, the description provides good context about the operation and usage alternatives. However, it could benefit from mentioning that this is a partial update (implied by 'fields to update') and clarifying authentication or permission requirements. The existence of an output schema means return values don't need explanation.

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 already fully documents both parameters (agent_id and update_data with its nested properties). The description mentions 'provided data' but doesn't add meaningful semantic context beyond what's in the schema. Baseline 3 is appropriate when schema does the heavy lifting.

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 ('Update an existing agent by ID') and resource ('agent'), distinguishing it from siblings like create_agent (creation) or delete_agent (deletion). It precisely identifies the operation as modifying an existing entity rather than creating a new one.

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 versus alternatives: it directs users to get_agent_summary for current config, list_llm_models/list_embedding_models for model options, and specifically states to use attach_tool for tools instead of this tool. This clearly defines the scope and exclusions.

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