check_tracking_status
Monitor email engagement by checking if tracked emails have been opened, providing open counts, device details, and timestamps for analysis.
Instructions
Check if a tracked email has been opened. Returns open count, device info, and timestamps.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| trackingId | Yes | Tracking ID returned from send_tracked_email |
Implementation Reference
- lib/tracking.js:51-68 (handler)Actual implementation of the tracking status check logic.
export async function checkStatus(trackingId) { const apiKey = getApiKey(); const email = getUserEmail(); const res = await fetch(`${API_BASE}/status?id=${encodeURIComponent(trackingId)}&email=${encodeURIComponent(email)}`, { headers: { 'X-API-Key': apiKey }, }); if (!res.ok) { const body = await res.text(); if (res.status === 404) { throw new Error(`Tracking ID not found: ${trackingId}`); } throw new Error(`Failed to check status (${res.status}): ${body}`); } return res.json(); } - mcp-server.js:63-91 (registration)Tool registration and handler wrapper for check_tracking_status.
server.tool( 'check_tracking_status', 'Check if a tracked email has been opened. Returns open count, device info, and timestamps.', { trackingId: z.string().describe('Tracking ID returned from send_tracked_email'), }, async ({ trackingId }) => { if (!isAuthenticated()) { return { content: [{ type: 'text', text: 'Not authenticated. Run `doubletick login` in the terminal first.' }] }; } const data = await checkStatus(trackingId); let text = `Tracking: ${data.trackingId}\n`; text += `Subject: ${data.emailSubject || '(no subject)'}\n`; text += `To: ${data.recipientEmail || '(unknown)'}\n`; text += `Status: ${data.statusMessage}\n`; text += `Open count: ${data.openCount}\n`; if (data.opens?.length > 0) { text += '\nOpens:\n'; for (const open of data.opens) { text += ` - ${open.formattedTimestamp || open.timeAgo} · ${open.device || 'Unknown'}\n`; } } return { content: [{ type: 'text', text }] }; } );