Skip to main content
Glama

wiki_get

Retrieve Wikipedia articles by title and language to access encyclopedic information for research or reference.

Instructions

Alias of wiki.get

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleYes
langNo

Implementation Reference

  • The core handler function that fetches and returns Wikipedia page summary using the public REST API.
    export async function wikiGet(title: string, lang = 'vi') {
      const url = `https://${lang}.wikipedia.org/api/rest_v1/page/summary/${encodeURIComponent(title)}`;
      const res = await fetchWithLimits(url, 8000, 1024*1024);
      if (!res.body) return null;
      const data = JSON.parse(res.body.toString('utf-8'));
      return {
        title: data.title,
        url: data.content_urls?.desktop?.page || data.canonical || '',
        abstract: data.extract || '',
        source: 'wikipedia',
        updatedAt: data.timestamp || new Date().toISOString()
      };
    }
  • src/server.ts:218-223 (registration)
    MCP server registration for the 'wiki_get' tool, invoking the wikiGet handler and formatting response.
    server.tool('wiki_get', 'Alias of wiki.get',
      wikiGetShape, OPEN,
      async ({ title, lang }) => {
        const res = await wikiGet(title, lang || 'vi');
        return { content: [{ type: 'text', text: JSON.stringify(res) }] };
      }
  • Input schema validation using Zod for the wiki_get tool parameters.
    const wikiGetShape = { title: z.string(), lang: z.string().optional() };

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/khanhs-234/tool4lm'

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