// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { Metadata, asErrorResult, asTextContentResult } from '@whop/mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; import Whop from '@whop/sdk'; export const metadata: Metadata = { resource: 'setup_intents', operation: 'read', tags: [], httpMethod: 'get', httpPath: '/setup_intents', operationId: 'listSetupIntent', }; export const tool: Tool = { name: 'list_setup_intents', description: 'A setup intent is an object used to securely collect and store a member’s payment method for future use without charging them immediately. It handles authentication steps up front so future off-session payments can be completed smoothly. This ensures the payment method is verified and ready for later billing.\n\nRequired permissions:\n - `payment:setup_intent:read`\n - `member:basic:read`\n - `member:email:read`', inputSchema: { type: 'object', properties: { company_id: { type: 'string', description: 'The ID of the company to list setup intents for', }, after: { type: 'string', description: 'Returns the elements in the list that come after the specified cursor.', }, before: { type: 'string', description: 'Returns the elements in the list that come before the specified cursor.', }, created_after: { type: 'string', description: 'The minimum creation date to filter by', format: 'date-time', }, created_before: { type: 'string', description: 'The maximum creation date to filter by', format: 'date-time', }, direction: { $ref: '#/$defs/direction', }, first: { type: 'integer', description: 'Returns the first _n_ elements from the list.', }, last: { type: 'integer', description: 'Returns the last _n_ elements from the list.', }, }, required: ['company_id'], $defs: { direction: { type: 'string', description: 'The direction of the sort.', enum: ['asc', 'desc'], }, }, }, annotations: { readOnlyHint: true, }, }; export const handler = async (client: Whop, args: Record | undefined) => { const body = args as any; const response = await client.setupIntents.list(body).asResponse(); try { return asTextContentResult(await response.json()); } catch (error) { if (error instanceof Whop.APIError) { return asErrorResult(error.message); } throw error; } }; export default { metadata, tool, handler };