privacy
Retrieve app privacy labels and data usage details from App Store listings to understand how applications handle user information.
Instructions
Get app privacy labels and data usage information
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | iTunes trackId of the app |
Implementation Reference
- src/server.js:390-435 (handler)Handler function that implements the core logic of the 'privacy' tool: fetches privacy data from App Store API using buildPrivacyUrl, parses it with parsePrivacy, and returns formatted JSON response or error./** * Privacy tool - Get app privacy labels */ async function handlePrivacy(args) { try { const { id } = args; if (!id) { throw new Error('id is required'); } const url = buildPrivacyUrl({ id }); const data = await fetchJSON(url); const privacy = parsePrivacy(data); if (!privacy) { return { content: [ { type: 'text', text: JSON.stringify({ error: 'Privacy data not available' }, null, 2), }, ], }; } return { content: [ { type: 'text', text: JSON.stringify(privacy, null, 2), }, ], }; } catch (error) { return { content: [ { type: 'text', text: JSON.stringify({ error: error.message }, null, 2), }, ], isError: true, }; } }
- src/server.js:1128-1141 (schema)Input schema definition for the 'privacy' tool in the ListTools response, requiring 'id' as a number (iTunes trackId).{ name: 'privacy', description: 'Get app privacy labels and data usage information', inputSchema: { type: 'object', properties: { id: { type: 'number', description: 'iTunes trackId of the app', }, }, required: ['id'], }, },
- src/server.js:1459-1460 (registration)Maps the 'privacy' tool name to the handlePrivacy function in the CallToolRequestSchema handler switch statement.case 'privacy': return await handlePrivacy(args);
- Helper function that parses and normalizes the raw JSON response from the App Store privacy API into a structured object.export function parsePrivacy(data) { if (!data || typeof data !== 'object') { return null; } return { managePrivacyChoicesUrl: data.managePrivacyChoicesUrl || null, privacyTypes: (data.privacyTypes || []).map(privacyType => ({ privacyType: privacyType.privacyType || null, identifier: privacyType.identifier || null, description: privacyType.description || null, dataCategories: (privacyType.dataCategories || []).map(category => ({ dataCategory: category.dataCategory || null, identifier: category.identifier || null, dataTypes: category.dataTypes || [], })), purposes: privacyType.purposes || [], })), }; }
- src/endpoints/appStore.js:124-132 (helper)Helper function that builds the URL for fetching app privacy details from the iTunes API.export function buildPrivacyUrl(params) { const { id } = params; if (!id) { throw new Error('id must be provided for privacy data'); } return `${ITUNES_BASE}/us/app-privacy-details/${id}.json`; }