> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tapti.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Performance Metrics

> Learn how to implement AI chatbots that can retrieve, analyze, and provide insights about social media performance metrics using the MCP server.

# Performance Metrics Analysis

This example demonstrates a simple workflow to retrieve social media performance metrics using the MCP server.

## Basic Workflow

<CodeGroup>
  ```text Simple Example theme={null}
  User: List all my users

  AI: [Calls get-users-by-tenant-app]
  Here are all your users:

  1. John Smith (john.smith@example.com)
     - ID: user-123-abc-456-def
     - Created: January 15, 2025

  2. Sarah Johnson (sarah.j@example.com)
     - ID: user-789-ghi-101-jkl
     - Created: February 3, 2025

  3. Michael Brown (m.brown@example.com)
     - ID: user-202-mno-303-pqr
     - Created: March 10, 2025

  User: List all user accounts Sarah Johnson have

  AI: [Calls get-user-accounts with user_id]
  Sarah Johnson (sarah.j@example.com) has the following user accounts:

  1. Instagram
     - ID: acct-456-insta-789
     - Platform Account ID: 123456789012345
     - Last refreshed: May 10, 2025
     - Status: Active

  2. Twitter
     - ID: acct-789-twtr-012
     - Platform Account ID: TwitterUser123
     - Last refreshed: May 9, 2025
     - Status: Active

  User: Fetch the performance metrics of Instagram account

  AI: [Calls get-account-engagement and get-audience-age-breakdown with user_account_id]
  Instagram Performance Metrics:

  Recent Daily Engagement:
  - Views: 1,250 per day
  - Comments: Increased from 85 to 110 in May
  - Likes: Increased from 320 to 475 in May
  - Reach: 3,600 accounts per day
  - Total Engagement: Increased from 2,800 to 3,450 in May

  Audience Demographics:
  - Age 18-24: 35%
  - Age 25-34: 42% (largest segment)
  - Age 35-44: 15%
  - Age 45-54: 6%
  - Age 55+: 2%
  ```
</CodeGroup>

## Implementation Steps

To implement this functionality, follow these simple steps:

1. **Get Users**: Use `get-users-by-tenant-app` to retrieve all users

2. **Get User Accounts**: Use `get-user-accounts` with the selected user's ID to retrieve their connected social media accounts

3. **Get Performance Metrics**: Use `get-account-engagement` and `get-audience-age-breakdown` with the selected account's ID to retrieve performance metrics

4. **Present Results**: Display the metrics in a clear, organized format

## Required MCP Tools

This implementation uses these tools:

* `get-users-by-tenant-app` - Lists all users
* `get-user-accounts` - Lists user's social media accounts
* `get-account-engagement` - Gets engagement metrics
* `get-audience-age-breakdown` - Gets audience demographics
