Skip to main content
The Query API MCP server provides 5 tools for querying consented user data. Each tool maps 1:1 to a Query API sync endpoint.
Tools use session credentials by default (provided during connection). You can override per-tool by passing auth_token and uid parameters.

Tool: get_search_data

Retrieve user search history (Google searches).

Parameters

Either provide in tool call or use session credentials from connection

Response Format

Example Usage


Tool: get_youtube_data

Retrieve user YouTube watch history and interactions.

Parameters

Either provide in tool call or use session credentials from connection

Response Format

Example Usage


Tool: get_browsing_data

Retrieve user web browsing history (Chrome).

Parameters

Either provide in tool call or use session credentials from connection

Response Format

Example Usage


Tool: get_ads_data

Retrieve user ad interactions (clicks and views).

Parameters

Either provide in tool call or use session credentials from connection

Response Format

Example Usage


Tool: get_receipts_data

Retrieve user purchase receipts (email receipts).

Parameters

Either provide in tool call or use session credentials from connection

Response Format

Example Usage


Common Patterns

Pagination

All tools support cursor-based pagination for large datasets:
  1. Make initial request (no cursor parameter)
  2. Check response has_more field
  3. If true, use next_cursor in next request
  4. Repeat until has_more = false

Delta Queries

Use ingested_begin/ingested_end to fetch only new data since last sync:
  1. Store last_sync_time after each sync
  2. Next sync: set ingested_begin = last_sync_time
  3. Update last_sync_time to response applied_ingested_end
  4. Repeat on subsequent syncs
This avoids re-fetching unchanged data.

Category Filtering

Categories use slash-delimited hierarchical paths:
  • /Shopping - All shopping data
  • /Shopping/Electronics - Electronics only
  • /Food/Restaurants - Restaurant searches/visits
Categories are assigned by Emerge’s classification system. Not all events have categories.

Error Handling

When a tool call fails, it returns an error structure:
Common error codes:
  • 401: Invalid credentials
  • 400: Invalid parameters (e.g., malformed timestamp)
  • 404: User not found (no consent)
  • 429: Rate limit exceeded
  • 500: Server error (retry with exponential backoff)

Best Practices

Use limit: 1000 for balanced performance and memory
Always check has_more for complete dataset retrieval
Use ingested_begin/end for incremental syncs
Apply category filters to reduce data volume
Handle errors gracefully with retry logic

Rate Limits

Per API token limits:
  • 100 requests/minute
  • 1000 requests/hour
Exceeding limits returns HTTP 429. Wait before retrying or contact support for higher limits.

Next Steps

Setup Guide

Configure AI tools to use these tools

Query API Reference

HTTP API equivalents

Examples

See workflow examples

MCP Query Setup

Architecture and configuration