// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { isJqError, maybeFilter } from '@whop/mcp/filtering'; 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: 'app_builds', operation: 'read', tags: [], httpMethod: 'get', httpPath: '/app_builds', operationId: 'listAppBuild', }; export const tool: Tool = { name: 'list_app_builds', description: "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nLists app builds for an app\n\nRequired permissions:\n - `developer:manage_builds`\n\n# Response Schema\n```json\n{\n type: 'object',\n description: 'The connection type for AppBuild.',\n properties: {\n data: {\n type: 'array',\n description: 'A list of nodes.',\n items: {\n $ref: '#/$defs/app_build_list_response'\n }\n },\n page_info: {\n $ref: '#/$defs/page_info'\n }\n },\n required: [ 'data',\n 'page_info'\n ],\n $defs: {\n app_build_list_response: {\n type: 'object',\n description: 'An App Build object representing a build of an application',\n properties: {\n id: {\n type: 'string',\n description: 'The ID of the app build. It will look like apbu_xxxxx.'\n },\n checksum: {\n type: 'string',\n description: 'This is generated by the client and used to verify the integrity of the file that is submitted. It is a SHA256 hash of the app build file.'\n },\n created_at: {\n type: 'string',\n description: 'When this app build was created.',\n format: 'date-time'\n },\n file_url: {\n type: 'string',\n description: 'The URL to download the app build .zip file.'\n },\n is_production: {\n type: 'boolean',\n description: 'Whether this app build is currently being used in production.'\n },\n platform: {\n $ref: '#/$defs/app_build_platforms'\n },\n review_message: {\n type: 'string',\n description: 'The review message for the app build, if any. This is populated when the build is rejected and there is a reason specified by the reviewer.'\n },\n status: {\n $ref: '#/$defs/app_build_statuses'\n },\n supported_app_view_types: {\n type: 'array',\n description: 'The supported app view types for the app build. These are the views that the developer has specified that this build supports.',\n items: {\n $ref: '#/$defs/app_view_type'\n }\n }\n },\n required: [ 'id',\n 'checksum',\n 'created_at',\n 'file_url',\n 'is_production',\n 'platform',\n 'review_message',\n 'status',\n 'supported_app_view_types'\n ]\n },\n app_build_platforms: {\n type: 'string',\n description: 'The different platforms an app build can target.',\n enum: [ 'ios',\n 'android',\n 'web'\n ]\n },\n app_build_statuses: {\n type: 'string',\n description: 'The different statuses an AppBuild can be in.',\n enum: [ 'draft',\n 'pending',\n 'approved',\n 'rejected'\n ]\n },\n app_view_type: {\n type: 'string',\n description: 'The different types of an app view',\n enum: [ 'hub',\n 'discover',\n 'dash',\n 'dashboard',\n 'analytics'\n ]\n },\n page_info: {\n type: 'object',\n description: 'Information about pagination in a connection.',\n properties: {\n end_cursor: {\n type: 'string',\n description: 'When paginating forwards, the cursor to continue.'\n },\n has_next_page: {\n type: 'boolean',\n description: 'When paginating forwards, are there more items?'\n },\n has_previous_page: {\n type: 'boolean',\n description: 'When paginating backwards, are there more items?'\n },\n start_cursor: {\n type: 'string',\n description: 'When paginating backwards, the cursor to continue.'\n }\n },\n required: [ 'end_cursor',\n 'has_next_page',\n 'has_previous_page',\n 'start_cursor'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { app_id: { type: 'string', description: 'The ID of the app to filter app builds by', }, 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', }, first: { type: 'integer', description: 'Returns the first _n_ elements from the list.', }, last: { type: 'integer', description: 'Returns the last _n_ elements from the list.', }, platform: { $ref: '#/$defs/app_build_platforms', }, status: { $ref: '#/$defs/app_build_statuses', }, jq_filter: { type: 'string', title: 'jq Filter', description: 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).', }, }, required: ['app_id'], $defs: { app_build_platforms: { type: 'string', description: 'The different platforms an app build can target.', enum: ['ios', 'android', 'web'], }, app_build_statuses: { type: 'string', description: 'The different statuses an AppBuild can be in.', enum: ['draft', 'pending', 'approved', 'rejected'], }, }, }, annotations: { readOnlyHint: true, }, }; export const handler = async (client: Whop, args: Record | undefined) => { const { jq_filter, ...body } = args as any; const response = await client.appBuilds.list(body).asResponse(); try { return asTextContentResult(await maybeFilter(jq_filter, await response.json())); } catch (error) { if (error instanceof Whop.APIError || isJqError(error)) { return asErrorResult(error.message); } throw error; } }; export default { metadata, tool, handler };