Skip to main content
Glama

delete_agent

Remove an agent from the Lightning Wallet MCP server, returning its remaining balance to the operator. Requires operator authorization and confirmation.

Instructions

Permanently delete an agent. Remaining balance is returned to operator. REQUIRES OPERATOR KEY.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
agent_idYesAgent ID to delete
confirmYesMust be true to confirm deletion

Implementation Reference

  • The deleteAgent method performs the actual API call to the backend for 'delete_agent'.
     * Delete an agent permanently
     */
    async deleteAgent(agentId: number): Promise<{
      message: string;
      balanceReturned: number;
      rawResponse: ApiResponse;
    }> {
      const result = await this.request<ApiResponse & {
        message?: string;
        balance_returned?: number;
      }>('delete_agent', { agent_id: agentId });
    
      return {
        message: result.message || 'Agent deleted',
        balanceReturned: result.balance_returned || 0,
        rawResponse: result,
      };
    }
  • The Zod schema definition for input validation of the 'delete_agent' tool.
    const DeleteAgentSchema = z.object({
      agent_id: z.number().int().positive().describe('Agent ID to permanently delete'),
      confirm: z.boolean().describe('Must be true to confirm deletion'),
    });
  • src/index.ts:742-752 (registration)
    Tool registration for 'delete_agent' in the MCP server's tool list.
      name: 'delete_agent',
      description: 'Permanently delete an agent. Remaining balance is returned to operator. REQUIRES OPERATOR KEY.',
      inputSchema: {
        type: 'object',
        properties: {
          agent_id: { type: 'integer', description: 'Agent ID to delete' },
          confirm: { type: 'boolean', description: 'Must be true to confirm deletion' },
        },
        required: ['agent_id', 'confirm'],
      },
    },
  • The MCP request handler logic for 'delete_agent', including validation and calling the client method.
    case 'delete_agent': {
      const parsed = DeleteAgentSchema.parse(args);
      if (!parsed.confirm) {
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({
                success: false,
                error: 'Must set confirm: true to delete agent',
              }, null, 2),
            },
          ],
          isError: true,
        };
      }
      const result = await session.requireClient().deleteAgent(parsed.agent_id);
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify({
              success: true,
              message: result.message || 'Agent deleted',
              balance_returned: result.balanceReturned,
            }, null, 2),
          },
        ],
      };
    }

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/lightningfaucet/lightning-wallet-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server