Skip to main content
Glama

get_rule

Retrieve detailed specifications for UI component rules to validate compliance with the components.build framework.

Instructions

Get details about a specific rule by ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ruleIdYesThe rule ID (e.g., "extends-html-props", "has-data-slot")

Implementation Reference

  • Main handler for the 'get_rule' MCP tool. Extracts ruleId from args, fetches the rule using getRule helper, handles not found case, and formats detailed markdown output including ID, category, severity, weight, description, bad/good examples.
    function handleGetRule(args: Record<string, unknown>): ToolResult {
      const ruleId = args.ruleId as string;
      const rule = getRule(ruleId);
    
      if (!rule) {
        return {
          content: [
            {
              type: 'text',
              text: `Rule not found: ${ruleId}\n\nAvailable rules:\n${getAllRules()
                .map((r) => `- ${r.id}`)
                .join('\n')}`,
            },
          ],
          isError: true,
        };
      }
    
      const text = `# ${rule.name}
    
    **ID:** \`${rule.id}\`
    **Category:** ${rule.category}
    **Severity:** ${rule.severity}
    **Weight:** ${rule.weight}
    
    ## Description
    ${rule.description}
    
    ## Bad Example
    \`\`\`tsx
    ${rule.example.bad}
    \`\`\`
    
    ## Good Example
    \`\`\`tsx
    ${rule.example.good}
    \`\`\`
    `;
    
      return {
        content: [{ type: 'text', text }],
      };
    }
  • Input schema definition for the 'get_rule' tool, specifying required 'ruleId' string parameter.
    {
      name: 'get_rule',
      description: 'Get details about a specific rule by ID',
      inputSchema: {
        type: 'object',
        properties: {
          ruleId: {
            type: 'string',
            description: 'The rule ID (e.g., "extends-html-props", "has-data-slot")',
          },
        },
        required: ['ruleId'],
      },
    },
  • Registration of the 'get_rule' tool handler in the main executeTool switch statement.
    case 'get_rule':
      return handleGetRule(args);
  • Helper function that retrieves a specific Rule object by its ID from the RULES array. Called by the get_rule handler.
    export function getRule(id: string): Rule | undefined {
      return RULES.find(r => r.id === id);
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states a read operation ('Get details'), which implies it's likely safe and non-destructive, but doesn't address potential errors (e.g., invalid rule IDs), authentication needs, rate limits, or return format. This leaves significant gaps for a tool with no annotation support.

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, clear sentence with no wasted words. It's front-loaded with the core purpose and efficiently conveys the essential information without unnecessary elaboration.

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?

For a tool with no annotations and no output schema, the description is insufficient. It doesn't explain what 'details' are returned (e.g., rule metadata, compliance criteria), error handling, or how it differs from sibling tools. This leaves the agent with incomplete context for effective use.

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 schema description coverage is 100%, with the single parameter 'ruleId' well-documented in the schema. The description adds no additional meaning beyond what the schema provides, such as example usage or edge cases. Given high schema coverage, the baseline score of 3 is appropriate.

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 action ('Get details') and resource ('specific rule by ID'), making the purpose understandable. However, it doesn't distinguish this from sibling tools like 'get_rules' or 'list_rules', which likely retrieve multiple rules rather than a single one by ID.

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 provides no guidance on when to use this tool versus alternatives such as 'get_rules' or 'list_rules'. It mentions 'by ID' but doesn't clarify prerequisites or contexts where this is preferred over other retrieval methods.

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

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/getlokiui/components-build-mcp'

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