Skip to main content
Glama

get_rules

Retrieve accessibility rules for web testing, with options to filter by tags like WCAG standards or best practices, ensuring compliance with Axe-core API and Puppeteer.

Instructions

Get information about available accessibility rules with optional filtering

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tagsNoFilter rules by these tags (e.g., "wcag2a", "wcag2aa", "best-practice")

Implementation Reference

  • The handler function for the 'get_rules' tool. It extracts optional 'tags' from input arguments, calls axe.getRules() to fetch accessibility rules (filtered or all), maps them to a simplified structure (ruleId, description, help, helpUrl, tags), and returns formatted JSON content.
    async getRules(args: any) {
      const { tags } = args;
      
      try {
        // Get the axe rules
        let rules;
        
        if (tags && tags.length > 0) {
          // Filter rules by tags
          rules = axe.getRules(tags);
        } else {
          // Get all rules
          rules = axe.getRules();
        }
        
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({
                rules: rules.map((rule: any) => ({
                  ruleId: rule.ruleId,
                  description: rule.description,
                  help: rule.help,
                  helpUrl: rule.helpUrl,
                  tags: rule.tags
                }))
              }, null, 2),
            },
          ],
        };
      } catch (error) {
        console.error('[Error] Failed to get rules:', error);
        throw new McpError(
          ErrorCode.InternalError,
          `Failed to get rules: ${error instanceof Error ? error.message : String(error)}`
        );
      }
    }
  • The input schema definition for the 'get_rules' tool, specifying an optional 'tags' array parameter for filtering rules.
    inputSchema: {
      type: 'object',
      properties: {
        tags: {
          type: 'array',
          items: { type: 'string' },
          description: 'Filter rules by these tags (e.g., "wcag2a", "wcag2aa", "best-practice")',
        }
      },
  • src/index.ts:86-99 (registration)
    Registration of the 'get_rules' tool in the ListTools response, including name, description, and input schema.
    {
      name: 'get_rules',
      description: 'Get information about available accessibility rules with optional filtering',
      inputSchema: {
        type: 'object',
        properties: {
          tags: {
            type: 'array',
            items: { type: 'string' },
            description: 'Filter rules by these tags (e.g., "wcag2a", "wcag2aa", "best-practice")',
          }
        },
      },
    },
  • src/index.ts:166-167 (registration)
    Dispatch/registration in the CallToolRequestSchema handler switch statement, routing 'get_rules' calls to the getRules method.
    case 'get_rules':
      return await this.getRules(request.params.arguments);
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool 'Get information', implying a read-only operation, but doesn't clarify aspects like whether it requires authentication, has rate limits, returns paginated results, or what the output format is. This leaves significant gaps in understanding how the tool behaves beyond basic functionality.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the purpose and key feature ('optional filtering') without any wasted words. It's front-loaded and appropriately sized for the tool's complexity, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations and output schema, the description is incomplete for a tool that likely returns structured data about accessibility rules. It doesn't explain what information is returned, how results are formatted, or any behavioral traits like error handling. This leaves the agent with insufficient context to use the tool effectively beyond basic invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with the 'tags' parameter well-documented in the schema itself. The description adds 'optional filtering', which aligns with the schema but doesn't provide additional semantic context beyond what's already specified. This meets the baseline for high schema coverage, but no extra value is added.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Get') and resource ('information about available accessibility rules'), making the purpose understandable. However, it doesn't differentiate this tool from its siblings like 'test_accessibility' or 'check_aria_attributes', which might also involve accessibility rules, so it doesn't fully distinguish itself from alternatives.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description includes 'optional filtering', which implies some context for usage, but it doesn't provide explicit guidance on when to use this tool versus its siblings. There's no mention of alternatives, prerequisites, or specific scenarios where this tool is preferred, leaving the agent with minimal direction.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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/ronantakizawa/a11ymcp'

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