Skip to main content
Glama
blaze-xyz
by blaze-xyz

list_withdrawals

Retrieve withdrawal transaction history from the Bitso cryptocurrency exchange to track and monitor outgoing funds with proper authentication.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler function that executes the list_withdrawals tool: validates params with Zod schema, fetches withdrawals via BitsoApiClient, formats and returns JSON response or error messages.
      async (params): Promise<ToolResult> => {
        try {
          const validatedParams = ListWithdrawalsSchema.parse(params);
          logToFile('INFO', 'List withdrawals tool called', validatedParams);
          
          const response = await client.getWithdrawals(validatedParams);
          
          if (!response.success || !response.payload || response.payload.length === 0) {
            return {
              content: [
                {
                  type: "text",
                  text: "No withdrawals found with the specified criteria."
                }
              ]
            };
          }
          
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify({
                  success: true,
                  count: response.payload.length,
                  withdrawals: response.payload.map(withdrawal => ({
                    wid: withdrawal.wid,
                    status: withdrawal.status,
                    currency: withdrawal.currency,
                    amount: withdrawal.amount,
                    method: withdrawal.method,
                    created_at: withdrawal.created_at,
                    origin_id: withdrawal.origin_id || null,
                    asset: withdrawal.asset || null,
                    network: withdrawal.network || null,
                    protocol: withdrawal.protocol || null
                  }))
                }, null, 2)
              }
            ]
          };
        } catch (error) {
          logToFile('ERROR', 'Error in list_withdrawals tool', error);
          
          if (error instanceof z.ZodError) {
            const errorMessage = error.errors.map(err => `${err.path.join('.')}: ${err.message}`).join(', ');
            return {
              content: [
                {
                  type: "text",
                  text: `Validation error: ${errorMessage}`
                }
              ]
            };
          }
          
          return {
            content: [
              {
                type: "text",
                text: `Error listing withdrawals: ${error instanceof Error ? error.message : String(error)}`
              }
            ]
          };
        }
      }
    );
  • Zod input schema for list_withdrawals tool parameters (currency, limit, marker, method, origin_id, status, wid). Used in handler for validation.
    const ListWithdrawalsSchema = z.object({
      currency: z.string().optional(),
      limit: z.number().int().positive().max(100).optional(),
      marker: z.string().optional(),
      method: z.string().optional(),
      origin_id: z.string().optional(),
      status: z.string().optional(),
      wid: z.string().optional(),
    });
  • MCP server tool registration for 'list_withdrawals', including name, description, JSON inputSchema, and inline handler function.
    server.tool(
      "list_withdrawals",
      {
        description: "List withdrawals with optional filtering parameters",
        inputSchema: {
          type: "object",
          properties: {
            currency: {
              type: "string",
              description: "Filter by transaction currency"
            },
            limit: {
              type: "number",
              description: "Number of objects to return (max 100, default 25)",
              minimum: 1,
              maximum: 100
            },
            marker: {
              type: "string",
              description: "Pagination marker"
            },
            method: {
              type: "string",
              description: "Filter by withdrawal method"
            },
            origin_id: {
              type: "string",
              description: "Filter by client-supplied ID"
            },
            status: {
              type: "string",
              description: "Filter by withdrawal status"
            },
            wid: {
              type: "string",
              description: "Filter by specific withdrawal ID"
            }
          }
        }
      },
      async (params): Promise<ToolResult> => {
        try {
          const validatedParams = ListWithdrawalsSchema.parse(params);
          logToFile('INFO', 'List withdrawals tool called', validatedParams);
          
          const response = await client.getWithdrawals(validatedParams);
          
          if (!response.success || !response.payload || response.payload.length === 0) {
            return {
              content: [
                {
                  type: "text",
                  text: "No withdrawals found with the specified criteria."
                }
              ]
            };
          }
          
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify({
                  success: true,
                  count: response.payload.length,
                  withdrawals: response.payload.map(withdrawal => ({
                    wid: withdrawal.wid,
                    status: withdrawal.status,
                    currency: withdrawal.currency,
                    amount: withdrawal.amount,
                    method: withdrawal.method,
                    created_at: withdrawal.created_at,
                    origin_id: withdrawal.origin_id || null,
                    asset: withdrawal.asset || null,
                    network: withdrawal.network || null,
                    protocol: withdrawal.protocol || null
                  }))
                }, null, 2)
              }
            ]
          };
        } catch (error) {
          logToFile('ERROR', 'Error in list_withdrawals tool', error);
          
          if (error instanceof z.ZodError) {
            const errorMessage = error.errors.map(err => `${err.path.join('.')}: ${err.message}`).join(', ');
            return {
              content: [
                {
                  type: "text",
                  text: `Validation error: ${errorMessage}`
                }
              ]
            };
          }
          
          return {
            content: [
              {
                type: "text",
                text: `Error listing withdrawals: ${error instanceof Error ? error.message : String(error)}`
              }
            ]
          };
        }
      }
    );

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/blaze-xyz/bitso-mcp'

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