// 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: 'products', operation: 'write', tags: [], httpMethod: 'post', httpPath: '/products', operationId: 'createProduct', }; export const tool: Tool = { name: 'create_products', description: 'Creates a new Product\n\nRequired permissions:\n - `access_pass:create`\n - `access_pass:basic:read`', inputSchema: { type: 'object', properties: { company_id: { type: 'string', description: 'The ID of the company to create the product for.', }, title: { type: 'string', description: 'The title of the product. It must be max 40 characters.', }, business_type: { $ref: '#/$defs/business_types', }, collect_shipping_address: { type: 'boolean', description: 'Whether or not to collect shipping information at checkout from the customer.', }, custom_cta: { $ref: '#/$defs/custom_cta', }, custom_cta_url: { type: 'string', description: 'The custom call to action URL for the product.', }, custom_statement_descriptor: { type: 'string', description: 'The custom statement descriptor for the product i.e. WHOP*SPORTS, must be between 5 and 22 characters, contain at least one letter, and not contain any of the following characters: <, >, \\, \', "', }, description: { type: 'string', description: 'A written description of the product.', }, experience_ids: { type: 'array', description: 'An array of experience IDs that this pass has', items: { type: 'string', description: 'Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `"VXNlci0xMA=="`) or integer (such as `4`) input value will be accepted as an ID.', }, }, global_affiliate_percentage: { type: 'number', description: 'The percentage of the revenue that goes to the global affiliate program.', }, global_affiliate_status: { $ref: '#/$defs/global_affiliate_status', }, headline: { type: 'string', description: 'The headline of the product.', }, industry_type: { $ref: '#/$defs/industry_types', }, member_affiliate_percentage: { type: 'number', description: 'The percentage of the revenue that goes to the member affiliate program.', }, member_affiliate_status: { $ref: '#/$defs/global_affiliate_status', }, plan_options: { type: 'object', description: 'The details to assign an autogenerated plan.', properties: { base_currency: { $ref: '#/$defs/currency', }, billing_period: { type: 'integer', description: 'The interval at which the plan charges (renewal plans).', }, custom_fields: { type: 'array', description: 'An array of custom field objects.', items: { type: 'object', properties: { field_type: { type: 'string', description: 'The type of the custom field.', enum: ['text'], }, name: { type: 'string', description: 'The name of the custom field.', }, id: { type: 'string', description: 'The ID of the custom field (if being updated)', }, order: { type: 'integer', description: 'The order of the field.', }, placeholder: { type: 'string', description: 'The placeholder value of the field.', }, required: { type: 'boolean', description: 'Whether or not the field is required.', }, }, required: ['field_type', 'name'], }, }, initial_price: { type: 'number', description: 'An additional amount charged upon first purchase.', }, plan_type: { $ref: '#/$defs/plan_type', }, release_method: { $ref: '#/$defs/release_method', }, renewal_price: { type: 'number', description: 'The amount the customer is charged every billing period.', }, visibility: { $ref: '#/$defs/visibility', }, }, }, product_highlights: { type: 'array', description: 'The product highlights for the product.', items: { type: 'object', description: 'Input for creating a product highlight', properties: { content: { type: 'string', description: 'Text to display to describe the product highlight (max length 250 for qualification or benefits, 170 for who this is for, 140 for pricing features).', }, highlight_type: { type: 'string', description: 'The type of this highlight.', enum: ['qualification', 'benefit', 'who_this_is_for', 'pricing_feature'], }, title: { type: 'string', description: 'The title of the product highlight, if applicable.', }, }, required: ['content', 'highlight_type'], }, }, product_tax_code_id: { type: 'string', description: 'The ID of the product tax code to apply to this product.', }, redirect_purchase_url: { type: 'string', description: 'The URL to redirect the customer to after a purchase.', }, route: { type: 'string', description: 'The route of the product.', }, visibility: { $ref: '#/$defs/visibility', }, }, required: ['company_id', 'title'], $defs: { business_types: { type: 'string', description: 'The different business types a company can be.', enum: [ 'education_program', 'coaching', 'software', 'paid_group', 'newsletter', 'agency', 'physical_products', 'brick_and_mortar', 'events', 'coaching_and_courses', 'other', 'saas', 'course', 'community', ], }, custom_cta: { type: 'string', description: 'The different types of custom CTAs that can be selected.', enum: [ 'get_access', 'join', 'order_now', 'shop_now', 'call_now', 'donate_now', 'contact_us', 'sign_up', 'subscribe', 'purchase', 'get_offer', 'apply_now', 'complete_order', ], }, global_affiliate_status: { type: 'string', description: 'The different statuses of the global affiliate program for a product.', enum: ['enabled', 'disabled'], }, industry_types: { type: 'string', description: 'The different industry types a company can be in.', enum: [ 'trading', 'sports_betting', 'reselling', 'fitness', 'amazon_fba', 'real_estate', 'kindle_book_publishing', 'dating', 'agencies', 'health_and_wellness', 'social_media', 'sales', 'business', 'ecommerce', 'video_games', 'home_services', 'ai', 'public_speaking', 'personal_finance', 'careers', 'travel', 'clipping', 'spirituality', 'vas', 'personal_development', 'software', 'other', 'marketing_agency', 'sales_agency', 'ai_agency', 'design_agency', 'coaching_agency', 'development_agency', 'recruiting_agency', 'customer_support_agency', 'clipping_agency', 'clothing', 'supplements', 'beauty_and_personal_care', 'fitness_gear', 'accessories', 'home_goods', 'electronics_and_gadgets', 'food_and_beverages', 'gym', 'restaurant', 'retail_store', 'coffee_shop', 'salon_spa', 'medical_dentist_office', 'hotel_lodging', 'auto_repair_shop', 'masterminds', 'webinars', 'bootcamps', 'convention', 'concerts', 'meetups', 'parties', ], }, currency: { type: 'string', description: 'The available currencies on the platform', enum: [ 'usd', 'sgd', 'inr', 'aud', 'brl', 'cad', 'dkk', 'eur', 'nok', 'gbp', 'sek', 'chf', 'hkd', 'huf', 'jpy', 'mxn', 'myr', 'pln', 'czk', 'nzd', 'aed', 'eth', 'ape', 'cop', 'ron', 'thb', 'bgn', 'idr', 'dop', 'php', 'try', 'krw', 'twd', 'vnd', 'pkr', 'clp', 'uyu', 'ars', 'zar', 'dzd', 'tnd', 'mad', 'kes', 'kwd', 'jod', 'all', 'xcd', 'amd', 'bsd', 'bhd', 'bob', 'bam', 'khr', 'crc', 'xof', 'egp', 'etb', 'gmd', 'ghs', 'gtq', 'gyd', 'ils', 'jmd', 'mop', 'mga', 'mur', 'mdl', 'mnt', 'nad', 'ngn', 'mkd', 'omr', 'pyg', 'pen', 'qar', 'rwf', 'sar', 'rsd', 'lkr', 'tzs', 'ttd', 'uzs', 'rub', 'btc', 'cny', ], }, plan_type: { type: 'string', description: 'The type of plan that can be attached to a product', enum: ['renewal', 'one_time'], }, release_method: { type: 'string', description: 'The methods of how a plan can be released.', enum: ['buy_now', 'waitlist'], }, visibility: { type: 'string', description: 'Visibility of a resource', enum: ['visible', 'hidden', 'archived', 'quick_link'], }, }, }, annotations: {}, }; export const handler = async (client: Whop, args: Record | undefined) => { const body = args as any; try { return asTextContentResult(await client.products.create(body)); } catch (error) { if (error instanceof Whop.APIError) { return asErrorResult(error.message); } throw error; } }; export default { metadata, tool, handler };