Skip to main content
Glama

delete_agent

Remove a specific agent permanently from the Letta system by providing its unique ID. Use list_agents to identify agents before deletion.

Instructions

Delete a specific agent by ID. Use list_agents to find agent IDs. For bulk deletion, use bulk_delete_agents. WARNING: This action is permanent.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
agent_idYesThe ID of the agent to delete

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
messageNo
successYes
agent_idNo

Implementation Reference

  • The handler function that executes the delete_agent tool logic: validates agent_id, calls the API to delete the agent, handles errors like 404, and returns a success response with the deleted agent_id.
    export async function handleDeleteAgent(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
            // Note: axios delete method typically doesn't have a body, config is the second arg
            await server.api.delete(`/agents/${agentId}`, { headers });
    
            // Successful deletion usually returns 200 or 204 with no body
            return {
                content: [
                    {
                        type: 'text',
                        text: JSON.stringify({
                            agent_id: args.agent_id,
                        }),
                    },
                ],
            };
        } 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 inputSchema for validating the agent_id parameter.
    export const deleteAgentDefinition = {
        name: 'delete_agent',
        description:
            'Delete a specific agent by ID. Use list_agents to find agent IDs. For bulk deletion, use bulk_delete_agents. WARNING: This action is permanent.',
        inputSchema: {
            type: 'object',
            properties: {
                agent_id: {
                    type: 'string',
                    description: 'The ID of the agent to delete',
                },
            },
            required: ['agent_id'],
        },
    };
  • Registration of the delete_agent handler in the main tool call switch statement within registerToolHandlers.
    case 'delete_agent':
        return handleDeleteAgent(server, request.params.arguments);
  • Output schema definition for structured responses from the delete_agent tool.
    delete_agent: {
        type: 'object',
        properties: {
            success: { type: 'boolean' },
            agent_id: { type: 'string' },
            message: { type: 'string' },
        },
        required: ['success'],
    },
  • Annotations providing metadata about the delete_agent tool, including warnings about its dangerous nature and side effects.
    delete_agent: {
        title: 'Delete Agent',
        readOnly: false,
        requiresAuth: true,
        costLevel: 'low',
        executionTime: 'fast',
        sideEffects: 'Permanently removes agent and associated data',
        dangerous: true,
    },
Behavior4/5

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

The description adds valuable behavioral context beyond annotations. While annotations only provide a title ('Delete Agent'), the description discloses critical traits: the action is 'permanent' (irreversible destruction) and includes a 'WARNING' about this. This compensates for the lack of annotations like destructiveHint, providing essential safety information for a mutation tool.

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 highly efficient with three sentences that each serve a distinct purpose: stating the action, providing usage guidance, and warning about permanence. It is front-loaded with the core function and wastes no words, making it easy for an agent to parse quickly.

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 complexity (a destructive mutation), the description is mostly complete. It covers purpose, usage, and critical behavioral warnings. With an output schema present, return values don't need explanation. However, it lacks details on permissions or error conditions, which could be relevant for such a high-stakes operation.

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?

With 100% schema description coverage (the single parameter 'agent_id' is fully documented in the schema), the description adds minimal value beyond the schema. It mentions 'by ID' but doesn't provide additional syntax, format, or constraints. The baseline score of 3 reflects adequate but not enhanced parameter documentation.

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 ('Delete') and target resource ('a specific agent by ID'), distinguishing it from siblings like 'bulk_delete_agents' (for bulk operations) and 'list_agents' (for finding IDs). It uses precise verb+resource phrasing that leaves no ambiguity about the tool's function.

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 this tool ('Delete a specific agent by ID') versus alternatives ('Use list_agents to find agent IDs. For bulk deletion, use bulk_delete_agents'). It offers clear guidance on prerequisites (finding IDs) and sibling tool selection for different use cases.

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