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

get_withdrawals_by_origin_ids

Retrieve withdrawal transaction details from the Bitso cryptocurrency exchange by specifying origin identifiers to filter and access specific withdrawal records.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Registers the get_withdrawals_by_origin_ids tool using server.tool, including inputSchema and the handler function.
    server.tool(
      "get_withdrawals_by_origin_ids",
      {
        description: "Get withdrawals by comma-separated origin IDs (client-supplied IDs)",
        inputSchema: {
          type: "object",
          properties: {
            origin_ids: {
              type: "string",
              description: "Comma-separated origin IDs (e.g., 'origin1,origin2,origin3')"
            }
          },
          required: ["origin_ids"]
        }
      },
      async (params): Promise<ToolResult> => {
        try {
          const validatedParams = GetWithdrawalsByOriginIdsSchema.parse(params);
          logToFile('INFO', 'Get withdrawals by origin IDs tool called', { origin_ids: validatedParams.origin_ids });
          
          const response = await client.getWithdrawals({ origin_id: validatedParams.origin_ids });
          
          if (!response.success || !response.payload || response.payload.length === 0) {
            return {
              content: [
                {
                  type: "text",
                  text: "No withdrawals found with the specified origin IDs."
                }
              ]
            };
          }
          
          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, 2)
              }
            ]
          };
        } catch (error) {
          logToFile('ERROR', 'Error in get_withdrawals_by_origin_ids 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 retrieving withdrawals: ${error instanceof Error ? error.message : String(error)}`
              }
            ]
          };
        }
      }
    );
  • The handler function validates input using Zod schema, calls BitsoApiClient.getWithdrawals with origin_id filter, processes the response, and returns formatted JSON or error messages.
    async (params): Promise<ToolResult> => {
      try {
        const validatedParams = GetWithdrawalsByOriginIdsSchema.parse(params);
        logToFile('INFO', 'Get withdrawals by origin IDs tool called', { origin_ids: validatedParams.origin_ids });
        
        const response = await client.getWithdrawals({ origin_id: validatedParams.origin_ids });
        
        if (!response.success || !response.payload || response.payload.length === 0) {
          return {
            content: [
              {
                type: "text",
                text: "No withdrawals found with the specified origin IDs."
              }
            ]
          };
        }
        
        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, 2)
            }
          ]
        };
      } catch (error) {
        logToFile('ERROR', 'Error in get_withdrawals_by_origin_ids 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 retrieving withdrawals: ${error instanceof Error ? error.message : String(error)}`
            }
          ]
        };
      }
    }
  • Zod schema used for input validation in the get_withdrawals_by_origin_ids handler.
    const GetWithdrawalsByOriginIdsSchema = z.object({
      origin_ids: z.string().min(1, "Comma-separated origin IDs are required"),
    });

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