Skip to main content
Glama
Cicatriiz

Consumer Rights Wiki MCP Server

get_categories

Retrieve categories or pages from the Consumer Rights Wiki to explore topics like privacy violations, dark patterns, and deceptive pricing practices.

Instructions

Get all categories or pages in a specific category

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
categoryNoCategory name (without Category: prefix). If empty, lists all categories.
limitNoNumber of results to return (default: 20, max: 50)

Implementation Reference

  • The handler function that executes the 'get_categories' tool. It handles two cases: listing pages in a specific category using 'categorymembers' or listing all categories using 'allcategories' via the wiki API.
    private async getCategories(args: any) {
      const { category, limit = 20 } = args;
    
      if (category) {
        // Get pages in a specific category
        const data = await this.makeApiRequest({
          action: 'query',
          list: 'categorymembers',
          cmtitle: `Category:${category}`,
          cmlimit: Math.min(limit, 50).toString(),
          cmprop: 'ids|title|timestamp',
        });
    
        if (data.error) {
          throw new McpError(ErrorCode.InternalError, data.error.info);
        }
    
        const members = data.query?.categorymembers || [];
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({
                category: `Category:${category}`,
                members: members.map((member: any) => ({
                  title: member.title,
                  pageid: member.pageid,
                  timestamp: member.timestamp,
                  url: `${WIKI_BASE_URL}/${member.title.replace(/ /g, '_')}`,
                })),
              }, null, 2),
            },
          ],
        };
      } else {
        // List all categories
        const data = await this.makeApiRequest({
          action: 'query',
          list: 'allcategories',
          aclimit: Math.min(limit, 50).toString(),
          acprop: 'size',
        });
    
        if (data.error) {
          throw new McpError(ErrorCode.InternalError, data.error.info);
        }
    
        const categories = data.query?.allcategories || [];
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({
                categories: categories.map((cat: any) => ({
                  name: cat['*'],
                  size: cat.size,
                  url: `${WIKI_BASE_URL}/Category:${cat['*'].replace(/ /g, '_')}`,
                })),
              }, null, 2),
            },
          ],
        };
      }
    }
  • Input schema definition for the 'get_categories' tool, specifying parameters 'category' (optional string) and 'limit' (optional number).
    inputSchema: {
      type: 'object',
      properties: {
        category: {
          type: 'string',
          description: 'Category name (without Category: prefix). If empty, lists all categories.',
        },
        limit: {
          type: 'number',
          description: 'Number of results to return (default: 20, max: 50)',
          default: 20,
        },
      },
  • src/index.ts:132-149 (registration)
    Registration of the 'get_categories' tool in the ListTools response, including name, description, and input schema.
    {
      name: 'get_categories',
      description: 'Get all categories or pages in a specific category',
      inputSchema: {
        type: 'object',
        properties: {
          category: {
            type: 'string',
            description: 'Category name (without Category: prefix). If empty, lists all categories.',
          },
          limit: {
            type: 'number',
            description: 'Number of results to return (default: 20, max: 50)',
            default: 20,
          },
        },
      },
    },
  • src/index.ts:177-180 (registration)
    Dispatch case in the CallToolRequest handler that routes 'get_categories' calls to the getCategories method.
    case 'get_categories':
      return this.getCategories(request.params.arguments);
    case 'get_page_sections':
      return this.getPageSections(request.params.arguments);

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/Cicatriiz/consumer-rights-wiki-mcp'

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