GnistAI GnistAI
Log in

Getting Started with Wikipedia

Article summaries, search, and section content from Wikipedia — the free encyclopedia.

All Tutorials   |   Overview   |   Playground   |   MCP   |   REST API   |   Home
Reference

Data source: Wikimedia Foundation

Overview

Wikipedia wraps Wikimedia Foundation, handling authentication, pagination, and rate limits for you. This tutorial covers all 4 tools with working code examples you can copy and run.

Prerequisites

  1. Sign up at https://context.gnist.ai/signup for a free API key (100 calls/day).
  2. Choose your integration method: MCP protocol or REST API.

Connect via MCP

Add to your MCP client config (Claude Desktop, Cursor, etc.):

MCP Config
{
  "mcpServers": {
    "gnist-wikipedia": {
      "url": "https://context.gnist.ai/mcp/wikipedia/",
      "headers": {
        "Gnist-API-Key": "YOUR_API_KEY"
      }
    }
  }
}

Tools (4)

search_articles

Search Wikipedia articles by keyword. Finds articles matching the query and returns titles, snippets, and metadata. Examples: search_articles("quantum computing") -> articles about quantum computing search_articles("Norwegian fjords", limit=10) -> articles about fjords in Norway Returns: List of matching articles with title, snippet, page_id, and word_count.

ParameterTypeRequiredDescription
querystringrequiredSearch query — keywords or phrases to find Wikipedia articles.
limitintegeroptionalMax results to return (default 5, max 20). (default: 5)
curl -X POST "https://context.gnist.ai/mcp/wikipedia/" \
  -H "Content-Type: application/json" \
  -H "Gnist-API-Key: YOUR_API_KEY" \
  -d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "search_articles", "arguments": {"query": "renewable energy"}}}'
import httpx

resp = httpx.post(
    "https://context.gnist.ai/mcp/wikipedia/",
    headers={"Gnist-API-Key": "YOUR_API_KEY"},
    json={'id': 1,
 'jsonrpc': '2.0',
 'method': 'tools/call',
 'params': {'arguments': {'query': 'renewable energy'},
            'name': 'search_articles'}},
)
print(resp.json())

get_article_summary

Get a concise summary of a Wikipedia article. Returns the article's lead paragraph, description, thumbnail image, and URL. Fast way to get key facts about any topic. Examples: get_article_summary("Python (programming language)") -> Python summary get_article_summary("Albert Einstein") -> Einstein biography summary Returns: Article title, description, extract (plain text summary), page URL, and thumbnail.

ParameterTypeRequiredDescription
titlestringrequiredWikipedia article title (e.g. 'Artificial intelligence', 'Oslo').
curl -X POST "https://context.gnist.ai/mcp/wikipedia/" \
  -H "Content-Type: application/json" \
  -H "Gnist-API-Key: YOUR_API_KEY" \
  -d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "get_article_summary", "arguments": {"title": "'Artificial"}}}'
import httpx

resp = httpx.post(
    "https://context.gnist.ai/mcp/wikipedia/",
    headers={"Gnist-API-Key": "YOUR_API_KEY"},
    json={'id': 1,
 'jsonrpc': '2.0',
 'method': 'tools/call',
 'params': {'arguments': {'title': "'Artificial"},
            'name': 'get_article_summary'}},
)
print(resp.json())

get_article_sections

Get the full section structure and content of a Wikipedia article. Returns all sections with headings and plain text content. Useful when you need detailed information from specific parts of an article. Examples: get_article_sections("Climate change") -> all sections about climate change get_article_sections("History of Norway") -> detailed Norwegian history by section Returns: List of sections with heading, level, and plain text content.

ParameterTypeRequiredDescription
titlestringrequiredWikipedia article title (e.g. 'Machine learning', 'Norway').
curl -X POST "https://context.gnist.ai/mcp/wikipedia/" \
  -H "Content-Type: application/json" \
  -H "Gnist-API-Key: YOUR_API_KEY" \
  -d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "get_article_sections", "arguments": {"title": "'Machine"}}}'
import httpx

resp = httpx.post(
    "https://context.gnist.ai/mcp/wikipedia/",
    headers={"Gnist-API-Key": "YOUR_API_KEY"},
    json={'id': 1,
 'jsonrpc': '2.0',
 'method': 'tools/call',
 'params': {'arguments': {'title': "'Machine"}, 'name': 'get_article_sections'}},
)
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'.

ParameterTypeRequiredDescription
feedbackstringrequired
feedback_typestringoptional (default: general)
curl -X POST "https://context.gnist.ai/mcp/wikipedia/" \
  -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/wikipedia/",
    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())

Common Patterns

Search then retrieve
Use search_articles to find items, then get_article_summary to get full details. This two-step pattern is common for exploring data before drilling down.
Pagination
Several tools support limit, offset, or page parameters. Start with small limits during development, then increase for production queries.

FAQ

What data does Wikipedia provide?

Article summaries, search, and section content from Wikipedia — the free encyclopedia. It exposes 4 tools: search_articles, get_article_summary, get_article_sections, 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 Wikipedia API return?

JSON, via either MCP protocol (JSON-RPC 2.0) or REST API.

Next Steps

Related Tutorials