Skip to main content
Glama
sergeyklay

poe2-mcp-server

by sergeyklay

poe2_wiki_page

Retrieve complete wiki page content for Path of Exile 2 game information. Use after finding exact page titles to access detailed wikitext data.

Instructions

Get the full content of a specific wiki page from poe2wiki.net.

Use poe2_wiki_search first to find the exact page title, then use this to read the full content.

Args:

  • title (string): Exact wiki page title (from search results)

Returns: Full wikitext content of the page (may be long — truncated at 8000 chars).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleYesExact wiki page title

Implementation Reference

  • The main handler function for poe2_wiki_page tool. It takes a title parameter, calls getWikiPage() to fetch content from the wiki API, handles truncation for long pages (8000 chars), and returns formatted content with a wiki link. Includes error handling for failures.
    async ({ title }) => {
      try {
        let content = await getWikiPage(title);
        if (!content) {
          return {
            content: [
              {
                type: 'text',
                text: `Wiki page "${title}" not found or empty.`,
              },
            ],
          };
        }
    
        // Truncate very long pages
        if (content.length > 8000) {
          content = content.slice(0, 8000) + '\n\n... [truncated — page too long]';
        }
    
        return {
          content: [
            {
              type: 'text',
              text: `## Wiki: ${title}\nšŸ”— https://www.poe2wiki.net/wiki/${encodeURIComponent(title.replace(/ /g, '_'))}\n\n${content}`,
            },
          ],
        };
      } catch (error) {
        const msg = error instanceof Error ? error.message : String(error);
        return {
          isError: true,
          content: [{ type: 'text', text: `Error fetching wiki page: ${msg}` }],
        };
      }
    },
  • Input schema validation for poe2_wiki_page tool. Uses zod to validate that the title parameter is a non-empty string with minimum length of 1 character.
    inputSchema: {
      title: z.string().min(1).describe('Exact wiki page title'),
    },
  • Complete registration of the poe2_wiki_page tool. Includes tool metadata (title, description, inputSchema, annotations) and the handler function. Registered via server.registerTool() within the registerWikiTools() function.
      server.registerTool(
        'poe2_wiki_page',
        {
          title: 'PoE2 Wiki Page Content',
          description: `Get the full content of a specific wiki page from poe2wiki.net.
    
    Use poe2_wiki_search first to find the exact page title, then use this to read the full content.
    
    Args:
      - title (string): Exact wiki page title (from search results)
    
    Returns: Full wikitext content of the page (may be long — truncated at 8000 chars).`,
          inputSchema: {
            title: z.string().min(1).describe('Exact wiki page title'),
          },
          annotations: {
            readOnlyHint: true,
            destructiveHint: false,
            idempotentHint: true,
            openWorldHint: true,
          },
        },
        async ({ title }) => {
          try {
            let content = await getWikiPage(title);
            if (!content) {
              return {
                content: [
                  {
                    type: 'text',
                    text: `Wiki page "${title}" not found or empty.`,
                  },
                ],
              };
            }
    
            // Truncate very long pages
            if (content.length > 8000) {
              content = content.slice(0, 8000) + '\n\n... [truncated — page too long]';
            }
    
            return {
              content: [
                {
                  type: 'text',
                  text: `## Wiki: ${title}\nšŸ”— https://www.poe2wiki.net/wiki/${encodeURIComponent(title.replace(/ /g, '_'))}\n\n${content}`,
                },
              ],
            };
          } catch (error) {
            const msg = error instanceof Error ? error.message : String(error);
            return {
              isError: true,
              content: [{ type: 'text', text: `Error fetching wiki page: ${msg}` }],
            };
          }
        },
      );
  • The getWikiPage helper function that makes the actual HTTP request to poe2wiki.net API. Constructs the MediaWiki API URL to parse page content by title and returns the wikitext content.
    export async function getWikiPage(title: string): Promise<string> {
      const url = `https://www.poe2wiki.net/w/api.php?action=parse&page=${encodeURIComponent(title)}&prop=wikitext&format=json`;
      const data = await fetchJson<{ parse?: { wikitext?: { '*'?: string } } }>(url);
      return data.parse?.wikitext?.['*'] ?? '';
    }

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/sergeyklay/poe2-mcp-server'

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