Data source: Open Trivia Database (opentdb.com)
Overview
Trivia Questions wraps Open Trivia Database (opentdb.com), handling authentication, pagination, and rate limits for you. This tutorial covers all 3 tools with working code examples you can copy and run.
Prerequisites
- Sign up at https://context.gnist.ai/signup for a free API key (100 calls/day).
- Choose your integration method: MCP protocol or REST API.
Connect via MCP
Add to your MCP client config (Claude Desktop, Cursor, etc.):
{
"mcpServers": {
"gnist-trivia": {
"url": "https://context.gnist.ai/mcp/trivia/",
"headers": {
"Gnist-API-Key": "YOUR_API_KEY"
}
}
}
}
Tools (3)
get_trivia_questions
Get trivia questions from the Open Trivia Database. Args: amount: Number of questions to retrieve (1-50, default 10). category: Optional category ID to filter questions. Use get_trivia_categories() to see valid IDs. difficulty: Optional difficulty level — one of "easy", "medium", "hard". question_type: Optional question type — "multiple" (4 choices) or "boolean" (true/false). Returns: Dictionary with count and list of trivia questions, each containing category, difficulty, question text, correct answer, and incorrect answers.
| Parameter | Type | Required | Description |
|---|---|---|---|
amount | integer | optional | (default: 10) |
category | any | optional | |
difficulty | any | optional | |
question_type | any | optional |
curl -X POST "https://context.gnist.ai/mcp/trivia/" \
-H "Content-Type: application/json" \
-H "Gnist-API-Key: YOUR_API_KEY" \
-d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "get_trivia_questions", "arguments": {"amount": 10}}}'
import httpx
resp = httpx.post(
"https://context.gnist.ai/mcp/trivia/",
headers={"Gnist-API-Key": "YOUR_API_KEY"},
json={'id': 1,
'jsonrpc': '2.0',
'method': 'tools/call',
'params': {'arguments': {'amount': 10}, 'name': 'get_trivia_questions'}},
)
print(resp.json())
get_trivia_categories
List all available trivia question categories. Returns: Dictionary with count and list of categories, each with an id and name. Use the id when calling get_trivia_questions(category=...).
curl -X POST "https://context.gnist.ai/mcp/trivia/" \
-H "Content-Type: application/json" \
-H "Gnist-API-Key: YOUR_API_KEY" \
-d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "get_trivia_categories", "arguments": {}}}'
import httpx
resp = httpx.post(
"https://context.gnist.ai/mcp/trivia/",
headers={"Gnist-API-Key": "YOUR_API_KEY"},
json={'id': 1,
'jsonrpc': '2.0',
'method': 'tools/call',
'params': {'arguments': {}, 'name': 'get_trivia_categories'}},
)
print(resp.json())
report_feedback
Report a bug, feature request, or general feedback for this data source. Use this when something doesn't work as expected, when you'd like a new feature, or when you have suggestions for improvement. Args: feedback: Describe the issue or suggestion. feedback_type: One of 'bug', 'feature_request', or 'general'.
| Parameter | Type | Required | Description |
|---|---|---|---|
feedback | string | required | |
feedback_type | string | optional | (default: general) |
curl -X POST "https://context.gnist.ai/mcp/trivia/" \
-H "Content-Type: application/json" \
-H "Gnist-API-Key: YOUR_API_KEY" \
-d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "report_feedback", "arguments": {"feedback": "example"}}}'
import httpx
resp = httpx.post(
"https://context.gnist.ai/mcp/trivia/",
headers={"Gnist-API-Key": "YOUR_API_KEY"},
json={'id': 1,
'jsonrpc': '2.0',
'method': 'tools/call',
'params': {'arguments': {'feedback': 'example'}, 'name': 'report_feedback'}},
)
print(resp.json())
FAQ
What data does Trivia Questions provide?
Quiz and trivia questions by category and difficulty from the Open Trivia Database. It exposes 3 tools: get_trivia_questions, get_trivia_categories, report_feedback.
What do I need to get started?
A Gnist API key (free tier: 100 calls/day). Sign up at https://context.gnist.ai/signup.
What format does the Trivia Questions API return?
JSON, via either MCP protocol (JSON-RPC 2.0) or REST API.