Skip to main content
Glama

export_wallet

Export your Solana wallet secret key in base58 format to import into Phantom or Solflare for direct wallet control. Rate-limited to 5 exports per hour.

Instructions

Export the agent's Solana wallet secret key in base58 format. Import into Phantom or Solflare to control the wallet directly. Rate-limited to 5 exports per hour.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
agent_idNoThe agent's profile ID. Auto-filled from saved credentials if omitted.
owner_idNoThe owner's profile ID. Auto-filled from saved credentials if omitted.
api_keyNoThe agent's API key. Alternative auth method if owner_id is not available.

Implementation Reference

  • Implementation of the export_wallet tool, which retrieves and returns the Solana wallet secret key for an agent.
    // ── Tool: export_wallet ──
    
    server.tool(
      "export_wallet",
      "Export the agent's Solana wallet secret key in base58 format. Import into Phantom or Solflare to control the wallet directly. Rate-limited to 5 exports per hour.",
      {
        agent_id: z.string().optional().describe("The agent's profile ID. Auto-filled from saved credentials if omitted."),
        owner_id: z.string().optional().describe("The owner's profile ID. Auto-filled from saved credentials if omitted."),
        api_key: z.string().optional().describe("The agent's API key. Alternative auth method if owner_id is not available."),
      },
      async ({ agent_id, owner_id, api_key }) => {
        const saved = loadSavedAgents();
        const resolvedAgent = agent_id || (saved.length > 0 ? saved[saved.length - 1].agentId : null);
        const resolvedOwner = owner_id || getDefaultOwnerId();
        const resolvedApiKey = api_key || getDefaultApiKey();
    
        if (!resolvedAgent) {
          return { content: [{ type: "text", text: "No agent found. Create one first with `create_agent`, or pass agent_id." }], isError: true };
        }
    
        if (!resolvedOwner && !resolvedApiKey) {
          return { content: [{ type: "text", text: "Auth required: provide owner_id or api_key." }], isError: true };
        }
    
        const body: Record<string, string> = { agentId: resolvedAgent };
        if (resolvedOwner) body.ownerProfileId = resolvedOwner;
        if (resolvedApiKey) body.agentApiKey = resolvedApiKey;
    
        const result = (await apiPost("export-agent-wallet", body)) as any;
    
        if (!result.success) {
          return {
            content: [{ type: "text", text: `Export failed: ${result.error || "Unknown error"}` }],
            isError: true,
          };
        }
    
        return {
          content: [
            {
              type: "text",
              text: [
                `# Wallet Export: ${result.agent?.name || resolvedAgent}`,
                "",
                `**Wallet Address:** ${result.agent?.walletAddress || "unknown"}`,
                `**Network:** ${result.wallet?.network || "solana-devnet"}`,
                `**Format:** ${result.wallet?.format || "base58"}`,
                "",
                `**Secret Key:**`,
                `\`${result.wallet?.secretKey}\``,
                "",
                `Import this into Phantom or Solflare to control the wallet.`,
                `⚠️ Anyone with this key can move funds. Keep it safe.`,
              ].join("\n"),
            },
          ],
        };
      }
    );
Behavior4/5

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

With no annotations provided, the description carries full burden and does well by disclosing critical behavioral traits: the sensitive nature of exporting secret keys, the specific rate limit ('5 exports per hour'), and the intended use case for wallet control. It doesn't mention authentication requirements or error conditions, but covers key operational constraints.

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?

Three tightly focused sentences with zero waste: first states the core function, second provides usage context, third discloses critical constraint. Every sentence earns its place and the description is appropriately sized for this sensitive operation.

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?

For a sensitive wallet export tool with no annotations and no output schema, the description does well by covering purpose, usage context, and rate limiting. It could be more complete by mentioning authentication requirements, potential security implications, or what the output looks like, but provides sufficient context for safe usage.

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 baseline is 3. The description doesn't add any parameter-specific information beyond what's already documented in the schema, which thoroughly describes all three optional parameters and their auto-fill behaviors.

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 ('Export'), resource ('agent's Solana wallet secret key'), and format ('base58 format'), distinguishing it from sibling tools that focus on agent management, trading, or data retrieval rather than wallet export operations.

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 ('Import into Phantom or Solflare to control the wallet directly'), but doesn't explicitly state when NOT to use it or mention specific alternatives among the sibling tools for related wallet operations.

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