Skip to main content
Glama
AudienseCo

Audiense Insights MCP Server

Official
by AudienseCo

report-summary

Generate comprehensive summaries of Audiense intelligence reports, extracting key segment details, top insights, and influencer data for marketing analysis.

Instructions

Generates a comprehensive summary of an Audiense report, including segment details, top insights, and influencers.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
report_idYesThe ID of the intelligence report to summarize.

Implementation Reference

  • Core handler function that generates the comprehensive report summary by fetching report info, top insights, and top influencers for each segment.
    export async function generateReportSummary(reportId: string): Promise<ReportSummaryResponse | null> {
        const insightTypes = ['bio_keyword', 'country', 'age', 'city', 'language', 'gender', 'interest'];
        
        try {
            // Fetch the report info
            const reportInfo = await getReportInfo(reportId);
            
            if (!reportInfo) {
                console.error(`Failed to retrieve report info for ID: ${reportId}`);
                return null;
            }
    
            if (reportInfo.status === "pending") {
                return {
                    title: reportInfo.title,
                    status: reportInfo.status,
                    message: "Report is still processing. Try again later."
                };
            }
    
            if (!reportInfo.segments || reportInfo.segments.length === 0) {
                return {
                    title: reportInfo.title,
                    status: reportInfo.status,
                    message: "Report has no segments to analyze."
                };
            }
    
            // Get the full audience ID for influencer comparison
            const fullAudienceId = reportInfo.full_audience?.audience_influencers_id;
    
            // Process all segments in parallel
            const segmentPromises = reportInfo.segments.map(async segment => {
                const segmentInfluencersId = segment.audience_influencers_id;
                
                // Only attempt to get influencers if we have valid IDs
                const influencers = fullAudienceId && segmentInfluencersId ? 
                    await getTopInfluencers(segmentInfluencersId, fullAudienceId) : 
                    null;
                const insights = await getTopInsights(segment.id, insightTypes);
            
                return {
                    id: segment.id,
                    title: segment.title,
                    size: segment.size,
                    insights,
                    influencers
                };
            });
    
            const segments = await Promise.all(segmentPromises);
    
            // Return the complete report summary
            return {
                id: reportId,
                title: reportInfo.title,
                segmentation_type: reportInfo.segmentation_type,
                full_audience_size: reportInfo.full_audience?.size,
                segments,
                links: reportInfo.links
            };
        } catch (error) {
            console.error(`Error generating report summary for ${reportId}:`, error);
            return null;
        }
    }
  • src/index.ts:358-398 (registration)
    MCP tool registration for 'report-summary', including description, input schema, and thin wrapper handler that calls generateReportSummary and formats the response.
    server.tool(
        "report-summary",
        "Generates a comprehensive summary of an Audiense report, including segment details, top insights, and influencers.",
        {
            report_id: z.string().describe("The ID of the intelligence report to summarize."),
        },
        async ({ report_id }) => {
            const data = await generateReportSummary(report_id);
    
            if (!data) {
                return {
                    content: [
                        {
                            type: "text",
                            text: `Failed to generate summary for report ID: ${report_id}.`,
                        },
                    ],
                };
            }
    
            if (data.message) {
                return {
                    content: [
                        {
                            type: "text",
                            text: data.message,
                        },
                    ],
                };
            }
    
            return {
                content: [
                    {
                        type: "text",
                        text: JSON.stringify(data, null, 2)
                    }
                ]
            };
        }
    );
  • Zod input schema defining the required 'report_id' parameter as a string.
    {
        report_id: z.string().describe("The ID of the intelligence report to summarize."),
    },
  • TypeScript interface defining the structure of the report summary response.
    export type ReportSummaryResponse = {
        id?: string;
        title: string;
        status?: string;
        segmentation_type?: string;
        full_audience_size?: number;
        segments?: SegmentSummary[];
        links?: { app?: string; public?: string };
        message?: string;
    };
  • Helper function to fetch and rank top insights (e.g., demographics) for an audience segment.
    async function getTopInsights(
        audienceId: string,
        insightTypes: string[],
        topCount: number = 5
    ): Promise<Record<string, InsightValue[] | null>> {
        try {
            const insightsData = await getAudienceInsights(audienceId, insightTypes);
            
            if (!insightsData || !insightsData.insights.length) {
                console.error(`No insights found for audience ${audienceId} and insight types ${insightTypes.join(',')}`);
                return Object.fromEntries(insightTypes.map(type => [type, null]));
            }
    
            // Process each insight type
            const result: Record<string, InsightValue[] | null> = {};
            
            for (const insight of insightsData.insights) {
                // Sort values by percentage (descending) and take top N
                result[insight.name] = insight.values
                    .sort((a, b) => parseFloat(b.value) - parseFloat(a.value))
                    .slice(0, topCount)
                    .map(v => ({ key: v.key, value: parseFloat(v.value) }));
            }
            
            return result;
        } catch (error) {
            console.error(`Error fetching insights for audience ${audienceId}:`, error);
            return Object.fromEntries(insightTypes.map(type => [type, null]));
        }
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool generates a summary but lacks details on output format (e.g., structured data vs. text), performance characteristics (e.g., processing time), error handling, or any side effects. For a tool with no annotation coverage, this leaves significant gaps in understanding its behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core action ('Generates a comprehensive summary') and lists key components without unnecessary details. Every word earns its place, making it highly concise and well-structured for quick understanding.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (generating a comprehensive summary), lack of annotations, and no output schema, the description is incomplete. It doesn't explain what the summary output looks like (e.g., text, JSON structure), how comprehensive it is, or any limitations. For a tool with no structured output documentation, more detail is needed to guide effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with the single parameter 'report_id' fully documented in the schema as 'The ID of the intelligence report to summarize.' The description adds no additional parameter semantics beyond what the schema provides, such as format examples or validation rules. Baseline 3 is appropriate given high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Generates a comprehensive summary of an Audiense report' with specific components mentioned ('segment details, top insights, and influencers'). It distinguishes from some siblings like 'get-report-info' by emphasizing summary generation rather than basic information retrieval, though it doesn't explicitly differentiate from all siblings like 'get-audience-insights'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing a valid report_id), comparison with siblings like 'get-report-info' for basic metadata or 'get-audience-insights' for specific insights, or any exclusions. Usage context is implied but not stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/AudienseCo/mcp-audiense-insights'

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