Skip to main content
Glama

wiki_search

Search Wikipedia for specific queries in your preferred language using this tool. Enhance information retrieval with direct access to Wikipedia content, supporting comprehensive research and knowledge discovery.

Instructions

Alias of wiki.search

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
langNo
qYes

Implementation Reference

  • Core implementation of wikiSearch function that queries Wikipedia REST API for title search results.
    export async function wikiSearch(q: string, lang = 'vi', top = 5) { const url = `https://${lang}.wikipedia.org/w/rest.php/v1/search/title?q=${encodeURIComponent(q)}&limit=${top}`; const res = await fetchWithLimits(url, 8000, 1024*1024); if (!res.body) return []; const data = JSON.parse(res.body.toString('utf-8')); return (data.pages || []).map((p: any) => ({ title: p.title, url: `https://${lang}.wikipedia.org/wiki/${encodeURIComponent(p.key)}`, snippet: p.description || '', source: 'wikipedia' })); }
  • Zod schema defining input parameters for wiki_search tool: query string and optional language.
    const wikiSearchShape = { q: z.string(), lang: z.string().optional() };
  • src/server.ts:201-207 (registration)
    Registers the 'wiki_search' MCP tool, providing schema and thin handler that calls the core wikiSearch function.
    server.tool('wiki_search', 'Alias of wiki.search', wikiSearchShape, OPEN, async ({ q, lang }) => { const res = await wikiSearch(q, lang || 'vi'); return { content: [{ type: 'text', text: JSON.stringify(res) }] }; } );

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