Skip to main content
Glama

Withdraw SOL (one-shot)

withdraw

Withdraw SOL from deactivated stake accounts in one call. Send secret key via HTTPS for in-memory signing—never stored. Check readiness with check_withdraw_ready first. Omit amountSol to withdraw full balance.

Instructions

Withdraw SOL from a deactivated stake account in a single call. Secret key sent over HTTPS for in-memory signing, never stored. Use check_withdraw_ready first. Omit amountSol for full balance.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
walletAddressYesYour Solana wallet address (withdraw authority)
secretKeyYesYour base58-encoded secret key — sent to Blueprint server over HTTPS for in-memory signing, never stored or logged
stakeAccountAddressYesDeactivated stake account to withdraw from
amountSolNoAmount to withdraw in SOL (omit to withdraw full balance)

Implementation Reference

  • server.ts:110-130 (registration)
    Registration of the 'withdraw' tool on the MCP server, including its input schema (walletAddress, secretKey, stakeAccountAddress, amountSol), metadata (title, description, annotations), and the handler that calls POST /api/v1/withdraw on the Blueprint API.
    mcp.registerTool(
      'withdraw',
      {
        title: 'Withdraw SOL (one-shot)',
        description: 'Withdraw SOL from a deactivated stake account in a single call. Secret key sent over HTTPS for in-memory signing, never stored. Use check_withdraw_ready first. Omit amountSol for full balance.',
        inputSchema: {
          walletAddress: z.string().max(50).describe('Your Solana wallet address (withdraw authority)'),
          secretKey: z.string().min(80).max(100).describe('Your base58-encoded secret key — sent to Blueprint server over HTTPS for in-memory signing, never stored or logged'),
          stakeAccountAddress: z.string().max(50).describe('Deactivated stake account to withdraw from'),
          amountSol: z.number().finite().positive().max(9000000).nullish().describe('Amount to withdraw in SOL (omit to withdraw full balance)'),
        },
        annotations: WRITE_TX,
      },
      async ({ walletAddress, secretKey, stakeAccountAddress, amountSol }) => {
        const body: Record<string, unknown> = { walletAddress, secretKey, stakeAccountAddress };
        if (amountSol != null) body.amountSol = amountSol;
        const { ok, data } = await api('POST', '/api/v1/withdraw', body);
        if (!ok) return error(`Withdraw failed: ${(data as any)?.message || JSON.stringify(data)}`, { retry: 'withdraw', withdrawReady: 'check_withdraw_ready', accounts: 'check_stake_accounts' });
        return result(data, { relatedTools: { balance: 'check_balance', stake: 'stake' } });
      }
    );
  • Handler function for the 'withdraw' tool. Builds a request body with walletAddress, secretKey, stakeAccountAddress, and optional amountSol, then POSTs to /api/v1/withdraw. Handles errors by returning a formatted error with related tool suggestions, or returns the API response with related tool references for follow-up actions.
    async ({ walletAddress, secretKey, stakeAccountAddress, amountSol }) => {
      const body: Record<string, unknown> = { walletAddress, secretKey, stakeAccountAddress };
      if (amountSol != null) body.amountSol = amountSol;
      const { ok, data } = await api('POST', '/api/v1/withdraw', body);
      if (!ok) return error(`Withdraw failed: ${(data as any)?.message || JSON.stringify(data)}`, { retry: 'withdraw', withdrawReady: 'check_withdraw_ready', accounts: 'check_stake_accounts' });
      return result(data, { relatedTools: { balance: 'check_balance', stake: 'stake' } });
    }
  • Zod input schema defining the 'withdraw' tool's parameters: walletAddress (string, max 50), secretKey (string, min 80, max 100), stakeAccountAddress (string, max 50), and amountSol (optional positive number, max 9M SOL).
    inputSchema: {
      walletAddress: z.string().max(50).describe('Your Solana wallet address (withdraw authority)'),
      secretKey: z.string().min(80).max(100).describe('Your base58-encoded secret key — sent to Blueprint server over HTTPS for in-memory signing, never stored or logged'),
      stakeAccountAddress: z.string().max(50).describe('Deactivated stake account to withdraw from'),
      amountSol: z.number().finite().positive().max(9000000).nullish().describe('Amount to withdraw in SOL (omit to withdraw full balance)'),
  • The 'api' helper function used by the withdraw handler to make HTTP POST requests to the Blueprint backend (POST /api/v1/withdraw). Handles JSON serialization, timeout (30s), and error parsing.
    async function api(
      method: 'GET' | 'POST' | 'DELETE',
      path: string,
      body?: Record<string, unknown>
    ): Promise<{ ok: boolean; status: number; data: unknown }> {
      const url = `${API_BASE}${path}`;
      const headers: Record<string, string> = { 'Content-Type': 'application/json' };
      const res = await fetch(url, {
        method,
        headers,
        signal: AbortSignal.timeout(30_000),
        ...(body ? { body: JSON.stringify(body) } : {}),
      });
      const data = await res.json().catch(() => ({ error: 'non_json_response', status: res.status }));
      return { ok: res.ok, status: res.status, data };
    }
Behavior5/5

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

Beyond annotations (which are minimal), the description discloses security behavior: secret key sent over HTTPS for in-memory signing and never stored. It also notes the one-shot nature and the optional amountSol behavior. No contradiction with annotations.

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?

Two sentences, concise and front-loaded with the core purpose, with no unnecessary words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (one-shot withdrawal with security concerns), the description covers purpose, precondition, security, and optional parameter behavior—sufficient for an AI agent to select and invoke it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, but the description adds value by reinforcing the usage of 'check_withdraw_ready' (relevant to stakeAccountAddress) and the omit-for-full-balance behavior of amountSol. This goes beyond the schema's description.

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 action ('Withdraw SOL') and the resource ('from a deactivated stake account'), and specifies it's a single call, distinguishing it from potentially similar tools like 'withdraw_stake'.

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 advises using 'check_withdraw_ready first' and mentions omitting 'amountSol' for full balance, providing clear usage context. However, it does not explicitly exclude alternatives or state when not to use this tool.

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/blueprint-infrastructure/solentic-mcp'

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