Skip to main content
Glama
listBuyers.ts2.36 kB
import { z } from 'zod'; import { FinixContext, ToolFactory } from '../../types.js'; import { FinixClient } from '../../utils/finixClient.js'; const listBuyersPrompt = () => ` This tool will fetch a list of Buyers from Finix. It takes two arguments: - limit (int, optional): The number of buyers to return. - email (str, optional): A case-sensitive filter on the list based on the buyer's email field. `; const listBuyersParameters = () => z.object({ limit: z.number().int().min(1).max(100).optional().describe( 'A limit on the number of objects to be returned. Limit can range between 1 and 100.' ), email: z.string().optional().describe( 'A case-sensitive filter on the list based on the buyer\'s email field. The value must be a string.' ) }); const listBuyersAnnotations = () => ({ destructiveHint: false, idempotentHint: true, openWorldHint: true, readOnlyHint: true, title: 'List buyers' }); const listBuyers = async (client: FinixClient, _context: FinixContext, params: any): Promise<any> => { try { if (!client.hasCredentials()) { throw new Error('Finix username and password are required for this operation. Please configure FINIX_USERNAME and FINIX_PASSWORD in your environment.'); } const { limit, email } = params; // Build query parameters const queryParams = new URLSearchParams(); if (limit) queryParams.append('limit', limit.toString()); if (email) queryParams.append('email', email); const response = await client.get(`/identities?${queryParams.toString()}`); if (response.error) { throw new Error(`Error listing buyers: ${response.error.message}`); } const data = response.data; const identities = data._embedded?.identities || []; // Filter for buyers only and return just IDs like Stripe const buyers = identities .filter((identity: any) => identity.identity_roles?.includes('BUYER')) .map((buyer: any) => ({ id: buyer.id })); return buyers; } catch (error) { throw error; } }; const tool: ToolFactory = () => ({ method: 'list_buyers', name: 'List Buyers', description: listBuyersPrompt(), parameters: listBuyersParameters(), annotations: listBuyersAnnotations(), actions: { identities: { read: true } }, execute: listBuyers }); export default tool;

Implementation Reference

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/bquigley1/finix-mcp'

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