privacy
Retrieve app privacy labels and data usage details from app stores 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:393-435 (handler)The main handler function for the 'privacy' tool. Fetches app privacy data from the App Store API using buildPrivacyUrl, parses it with parsePrivacy, and returns a JSON-formatted response.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:1129-1141 (registration)Tool registration in ListToolsRequestSchema response, defining the 'privacy' tool name, description, and input schema requiring app 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)Switch case in CallToolRequestSchema handler that routes 'privacy' tool calls to the handlePrivacy function.case 'privacy': return await handlePrivacy(args);
- Helper function that normalizes raw privacy API response into structured privacyTypes with data categories and purposes.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 constructs the App Store privacy details JSON endpoint URL from the app trackId.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`; }