Skip to main content
Glama

get_analytics_data_by_id

Retrieve email analytics data for a specific message ID using TurboSMTP, enabling targeted tracking and analysis of email performance.

Instructions

Retrieve analytics data from TurboSMTP by specific message ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesMessage ID

Implementation Reference

  • The primary MCP tool handler: validates the input ID, delegates to EmailService.getAnalyticsDataById, formats the response output, and returns the MCP content block.
    async handleGetAnalyticsDataById(args) { const { id } = args; if (!id) { throw new Error('The "id" parameter is required'); } try { const result = await EmailService.getAnalyticsDataById(id); // Format the analytics data for better readability let formattedOutput = `📊 Analytics Data Retrieved Successfully!\n\n`; formattedOutput += `\n📈 Analytics Summary:\n`; formattedOutput += `${JSON.stringify(result.data, null, 2)}`; return { content: [ { type: 'text', text: formattedOutput } ] }; } catch (error) { throw new Error(`Error retrieving analytics data: ${error.message}`); } }
  • Tool metadata registration including name, description, and input schema definition used in ListToolsRequestHandler.
    { name: 'get_analytics_data_by_id', description: 'Retrieve analytics data from TurboSMTP by specific message ID', inputSchema: { type: 'object', properties: { id: { type: 'string', description: 'Message ID' } }, required: ['id'] } }
  • Tool dispatch registration in the CallToolRequestSchema switch statement.
    case 'get_analytics_data_by_id': return await this.handleGetAnalyticsDataById(args);
  • Supporting utility in EmailService: validates ID, makes HTTP GET to TurboSMTP analytics API `/analytics/{id}`, handles response and errors.
    async getAnalyticsDataById(id) { // Validation of 'id' parameter. if (!id) { throw new Error('The "id" parameter is required'); } console.log(id); try { const response = await axios.get( `${this.apiUrl}/analytics/${id}`, { headers: this.headers } ); // Returning response data on success. return { success: true, message: 'Analytics data successfully retrieved', data: response.data }; } catch (error) { // Handling HTTP request errors. console.error('Error retrieving analytics data:', error.response?.data || error.message); throw new Error( error.response?.data?.message || 'Error retrieving analytics data: ' + error.message ); } }

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/debba/turbosmtp-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server