Skip to main content
Glama

get_categories

Retrieve all categories associated with a specific page title on Wizzypedia to streamline content organization and navigation.

Instructions

Get categories a page belongs to

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleYesTitle of the page

Implementation Reference

  • MCP tool handler for 'get_categories': extracts title from arguments, calls wikiClient.getCategories, handles missing page, extracts category titles from API response, returns formatted JSON response.
    case "get_categories": { const { title } = request.params.arguments as { title: string }; const result = await wikiClient.getCategories(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 categories = page.categories ? page.categories.map((cat: any) => cat.title) : []; return { content: [ { type: "text", text: JSON.stringify( { title: page.title, categories }, null, 2 ) } ] }; }
  • MediaWikiClient helper method that performs the API query to retrieve categories for the given page title.
    async getCategories(title: string): Promise<any> { return this.makeApiCall({ action: "query", prop: "categories", titles: title, cllimit: "max" }); }
  • Tool definition including name, description, and input schema validating the required 'title' parameter.
    const GET_CATEGORIES_TOOL: Tool = { name: "get_categories", description: "Get categories a page belongs to", inputSchema: { type: "object", properties: { title: { type: "string", description: "Title of the page" } }, required: ["title"] } };
  • index.ts:598-607 (registration)
    Registers the tool by including GET_CATEGORIES_TOOL in the list returned for ListToolsRequestSchema.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [ SEARCH_PAGES_TOOL, READ_PAGE_TOOL, CREATE_PAGE_TOOL, UPDATE_PAGE_TOOL, GET_PAGE_HISTORY_TOOL, GET_CATEGORIES_TOOL ] }));

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/cryppadotta/mcp-wizzypedia'

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