Skip to main content
Glama

get_page_by_id

Retrieve a specific WikiJS page by its unique ID using this tool, enabling quick content access and integration within the WikiJS MCP Server environment.

Instructions

Get a WikiJS page by its ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesThe ID of the page to retrieve

Implementation Reference

  • The MCP tool handler function that extracts the page ID from the request, fetches the page using the WikiJS client, stringifies the result as JSON text content, or returns an error message if failed.
    return async (request) => { try { const { id } = request; const result = await wikiClient.getPageById(id); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2) } ] }; } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); return { content: [ { type: 'text', text: `Error getting page by ID: ${errorMessage}` } ], isError: true }; } }
  • Zod schema defining the input parameters for the tool: a required numeric 'id'.
    export const PARAMETERS ={ id: z.number().describe('The ID of the page to retrieve') };
  • src/mcp/index.ts:47-52 (registration)
    Registration of the 'get_page_by_id' tool on the MCP server, providing name, description, parameters schema, and the handler factory function.
    server.tool( 'get_page_by_id', 'Get a WikiJS page by its ID', GET_PAGE_BY_ID_TOOL_PARAMETERS, createGetPageByIdTool(this.wikiClient) );
  • Supporting method in WikiJSClient class that uses the GraphQL SDK to retrieve a page by its ID and returns the page data or null.
    async getPageById(id: number) { const result = await this.sdk.GetPageById({ id }); return result.pages?.single || null; }

Other Tools

Related Tools

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/RicardoCenci/wikijs-mcp'

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