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
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/bitso-tools.ts:304-382 (registration)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)}` } ] }; } } );
- src/tools/bitso-tools.ts:319-381 (handler)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)}` } ] }; } }
- src/tools/bitso-tools.ts:27-29 (schema)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"), });