read_page
Fetch raw wikitext content from Wizzypedia pages to access and work with article source material directly.
Instructions
Fetch the raw wikitext content of a page
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| title | Yes | Title of the page to read |
Implementation Reference
- index.ts:661-710 (handler)Handler function for executing the read_page tool. Extracts title from arguments, calls wikiClient.getPage(title), processes the result to extract content and metadata, handles missing pages, and returns formatted JSON response.case "read_page": { const { title } = request.params.arguments as { title: string }; const result = await wikiClient.getPage(title); const pages = result.query.pages; const page = pages[0]; if (page.missing) { return { content: [ { type: "text", text: JSON.stringify( { title: page.title, exists: false, message: "Page does not exist" }, null, 2 ) } ] }; } const revision = page.revisions[0]; const content = revision.slots.main.content; return { content: [ { type: "text", text: JSON.stringify( { title: page.title, content: content, lastEdit: { timestamp: revision.timestamp, user: revision.user, comment: revision.comment } }, null, 2 ) } ] }; }
- index.ts:486-499 (schema)Tool definition including name, description, and input schema for read_page tool, which requires a 'title' string.const READ_PAGE_TOOL: Tool = { name: "read_page", description: "Fetch the raw wikitext content of a page", inputSchema: { type: "object", properties: { title: { type: "string", description: "Title of the page to read" } }, required: ["title"] } };
- index.ts:598-607 (registration)Registration of all tools including read_page (READ_PAGE_TOOL) in the ListToolsRequestSchema handler.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [ SEARCH_PAGES_TOOL, READ_PAGE_TOOL, CREATE_PAGE_TOOL, UPDATE_PAGE_TOOL, GET_PAGE_HISTORY_TOOL, GET_CATEGORIES_TOOL ] }));
- index.ts:389-398 (helper)MediaWikiClient.getPage method: makes API call to query revisions of a page by title, retrieving content, timestamp, user, and comment.async getPage(title: string): Promise<any> { return this.makeApiCall({ action: "query", prop: "revisions", titles: title, rvprop: "content|timestamp|user|comment", rvslots: "main" }); }