Skip to main content
Glama

create_agent

Create a new agent with spending limits to autonomously manage Bitcoin Lightning payments and access paid APIs through the Lightning Wallet MCP server.

Instructions

Create a new agent under your operator account. Returns the agent API key.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesName for the agent
descriptionNoOptional description
budget_limit_satsNoOptional spending limit in sats

Implementation Reference

  • Handler for 'create_agent' tool call, uses the LightningFaucetClient to create a new agent.
    case 'create_agent': {
      const parsed = CreateAgentSchema.parse(args);
      const result = await session.requireClient().createAgent(
        parsed.name,
        parsed.description,
        parsed.budget_limit_sats
      );
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify({
              success: true,
              message: `Agent "${result.name}" created successfully`,
              agent_id: result.agentId,
              api_key: result.agentApiKey,
              name: result.name,
            }, null, 2),
          },
        ],
      };
    }
  • Implementation of createAgent in LightningFaucetClient, which sends the request to the backend.
    async createAgent(
      name: string,
      description?: string,
      budgetLimitSats?: number
    ): Promise<{
      agentId: number;
      agentApiKey: string;
      name: string;
      rawResponse: CreateAgentResponse;
    }> {
      const data: Record<string, unknown> = { name };
      if (description) data.description = description;
      if (budgetLimitSats !== undefined) data.budget_limit_sats = budgetLimitSats;
    
      const result = await this.request<CreateAgentResponse>('create_agent', data);
    
      const apiKey = result.agent_api_key || result.api_key;
      if (!apiKey) {
        throw new Error('No agent API key returned');
      }
    
      return {
        agentId: result.agent_id || 0,
        agentApiKey: apiKey,
        name: result.name || name,
        rawResponse: result,
      };
    }
  • Input schema validation for the create_agent tool.
    const CreateAgentSchema = z.object({
      name: z.string().describe('Name for the agent'),
      description: z.string().optional().describe('Optional description'),
      budget_limit_sats: z.number().min(0).optional().describe('Optional spending limit in sats'),
    });
  • src/index.ts:415-426 (registration)
    MCP tool registration for create_agent.
      name: 'create_agent',
      description: 'Create a new agent under your operator account. Returns the agent API key.',
      inputSchema: {
        type: 'object',
        properties: {
          name: { type: 'string', description: 'Name for the agent' },
          description: { type: 'string', description: 'Optional description' },
          budget_limit_sats: { type: 'integer', minimum: 0, description: 'Optional spending limit in sats' },
        },
        required: ['name'],
      },
    },

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