// 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/{id}', operationId: 'retrieveAppBuild', }; export const tool: Tool = { name: 'retrieve_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\nRetrieves an app build by ID\n\nRequired permissions:\n - `developer:manage_builds`\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/app_build',\n $defs: {\n app_build: {\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 }\n}\n```", inputSchema: { type: 'object', properties: { id: { type: 'string', }, 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: ['id'], }, annotations: { readOnlyHint: true, }, }; export const handler = async (client: Whop, args: Record | undefined) => { const { id, jq_filter, ...body } = args as any; try { return asTextContentResult(await maybeFilter(jq_filter, await client.appBuilds.retrieve(id))); } catch (error) { if (error instanceof Whop.APIError || isJqError(error)) { return asErrorResult(error.message); } throw error; } }; export default { metadata, tool, handler };