Skip to main content
Glama

create_agent

Create autonomous strategy agents that execute trading rules automatically every 5 minutes using funded wallets and API keys for competition pools.

Instructions

Create a new autonomous strategy agent. Gets a funded wallet (500 bsUSD) and API key. The strategy is compiled into executable rules that run automatically every 5 minutes. Credentials are saved locally to ~/.conviction/agents.json. Limit: 10 active agents per owner, 3 new agents per hour.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameNoAgent display name (optional, defaults to 'Conviction Agent')
strategyYesPlain English strategy (max 500 characters). Examples: "Enter with $5 on the likely winner when probability > 70%", "Go contrarian: pick the underdog when the pool is 60/40 or worse", "Enter every pool with $2, always pick the token with higher win probability"
owner_idNoOwner profile ID from conviction.fm. If not provided, a new anonymous owner is created automatically.

Implementation Reference

  • The tool "create_agent" handler implementation. It validates input, calls the register-agent API, and persists credentials to ~/.conviction/agents.json.
    // ── Tool: create_agent ──
    
    server.tool(
      "create_agent",
      "Create a new autonomous strategy agent. Gets a funded wallet (500 bsUSD) and API key. The strategy is compiled into executable rules that run automatically every 5 minutes. Credentials are saved locally to ~/.conviction/agents.json. Limit: 10 active agents per owner, 3 new agents per hour.",
      {
        name: z.string().optional().describe("Agent display name (optional, defaults to 'Conviction Agent')"),
        strategy: z
          .string()
          .describe(
            'Plain English strategy (max 500 characters). Examples: "Enter with $5 on the likely winner when probability > 70%", "Go contrarian: pick the underdog when the pool is 60/40 or worse", "Enter every pool with $2, always pick the token with higher win probability"'
          ),
        owner_id: z.string().optional().describe("Owner profile ID from conviction.fm. If not provided, a new anonymous owner is created automatically."),
      },
      async ({ name, strategy, owner_id }) => {
        if (!strategy || !strategy.trim()) {
          return {
            content: [{ type: "text", text: "Error: strategy is required. Describe how your agent should compete." }],
            isError: true,
          };
        }
    
        if (strategy.trim().length > 500) {
          return {
            content: [{ type: "text", text: `Error: strategy is too long (${strategy.trim().length} characters). Maximum is 500 characters. Try simplifying your rules.` }],
            isError: true,
          };
        }
    
        // Use provided owner_id, or reuse the last saved one, or let server auto-create
        const ownerProfileId = owner_id || getDefaultOwnerId() || undefined;
    
        const result = (await apiPost("register-agent", {
          ownerProfileId,
          agentName: name || "MCP Agent",
          agentDescription: "Created via MCP tool",
          agentRules: strategy,
        })) as any;
    
        if (!result.success) {
          return {
            content: [{ type: "text", text: `Error creating agent: ${result.error || "Unknown error"}` }],
            isError: true,
          };
        }
    
        const agent = result.agent || {};
        const compiled = result.compiled || {};
        const airdrop = result.airdrop || {};
    
        // Auto-persist credentials locally
        if (agent.id && agent.apiKey) {
          addSavedAgent({
            agentId: agent.id,
            ownerId: agent.owner,
            apiKey: agent.apiKey,
            name: agent.name || "MCP Agent",
            createdAt: new Date().toISOString(),
          });
        }
    
        return {
          content: [
            {
              type: "text",
              text: [
                "# Agent Created Successfully",
                "",
                `**Name:** ${agent.name || "MCP Agent"}`,
                `**Agent ID:** ${agent.id}`,
                `**Owner ID:** ${agent.owner}`,
                `**Wallet:** ${agent.walletAddress || "pending"}`,
                `**API Key:** ${agent.apiKey || "N/A"}`,
                `**Funded:** ${airdrop.funded ? "500 bsUSD + 0.01 SOL" : "Failed — " + (airdrop.error || "unknown error")}`,
                `**Rules Compiled:** ${compiled.success ? `Yes (${compiled.rulesCount} rules)` : "Pending"}`,
                "",
                "Your agent will start executing its strategy automatically every 5 minutes.",
                "Credentials saved to `~/.conviction/agents.json` — you won't lose access.",
                "Use `enter_position` to also enter pools manually (API key is auto-filled).",
              ].join("\n"),
            },
          ],
        };
      }
    );
  • Registration point for the create_agent tool.
    // ── Tool: create_agent ──
Behavior4/5

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

With no annotations provided, the description carries the full burden and effectively discloses key behavioral traits: it creates a funded wallet and API key, compiles strategies into executable rules running every 5 minutes, saves credentials locally, and enforces limits (10 active agents per owner, 3 new per hour). This covers mutation, automation, storage, and rate-limiting without contradictions.

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 front-loaded with the core purpose and efficiently details key features (funding, automation, storage, limits) in a single, well-structured sentence. Every element adds value without redundancy, making it concise and easy to parse.

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 complexity (creation tool with automation and limits), no annotations, and no output schema, the description is largely complete—it covers purpose, behavior, and constraints. However, it lacks details on error handling or response format, which could be useful for an agent invoking this tool.

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 documents all parameters thoroughly. The description does not add meaning beyond the schema, such as explaining how parameters interact with the behavioral traits (e.g., how 'strategy' affects the compiled rules). 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 specific action ('Create a new autonomous strategy agent') and resource ('agent'), distinguishing it from siblings like 'get_my_agents' or 'update_strategy' by emphasizing creation with funding and automation. It goes beyond a tautology by detailing the agent's capabilities and setup process.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context for when to use this tool (to create an automated agent with funding) and implies alternatives through sibling tools like 'get_my_agents' for viewing or 'update_strategy' for modifying, but does not explicitly state when not to use it or compare directly to other creation-related tools.

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/abcxz/conviction-fm'

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