Skip to main content
Glama

context_get_rules

Read-only

Retrieve repository coding rules and conventions. Returns the top max_rules rules for a repository by severity (default 20), or a specific rule by ID. Rules are extracted from CLAUDE.md, AGENTS.md, .cursorrules, CONTRIBUTING.md, and other convention files in the repository. Large repos can have hundreds of rules. Narrow the result with paths (the files you are working on) or language, or pass a larger max_rules to get more.

Input Schema

NameRequiredDescriptionDefault
taskNoOptional task filter: code-review, code-generation, or code-questions
pathsNoOptional repo-relative file paths (the files being reviewed, generated, or asked about) to scope rules to. A rule extracted from <dir>/CLAUDE.md (or similar) is returned only when at least one path is inside <dir>/. Rules from repo-root convention files always apply. Omit for repo-wide.
rule_idNoOptional rule ID to retrieve a specific rule
languageNoOptional language filter (e.g., 'kotlin', 'python', 'typescript')
max_rulesNoOptional maximum number of rules to return, highest severity first. Default 20; pass a larger value to get more.
repo_nameYesRepository to retrieve rules for. Use 'owner/repo' form (e.g. 'unblocked/unblocked').

Output Schema

NameRequiredDescriptionDefault
textYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed5 schema fields changed
    • changedInput schema / properties / max_rules / description
      Previous value: -"Optional maximum number of rules to return, highest severity first. Omit for all rules."New value: +"Optional maximum number of rules to return, highest severity first. Default 20; pass a larger value to get more."
    • changedInput schema / properties / max_rules / type
      Previous value: -"string"New value: +"integer"
    • changedInput schema / properties / paths / description
      Previous value: -"Optional repo-relative file paths to scope rules to, one per line. A rule extracted\n            from <dir>/CLAUDE.md (or similar) is returned only when at least one path is inside\n            <dir>/. Rules from repo-root convention files always apply. Pass the files being\n            reviewed, generated, or asked about. Omit for repo-wide."New value: +"Optional repo-relative file paths (the files being reviewed, generated, or asked\n            about) to scope rules to. A rule extracted from <dir>/CLAUDE.md (or similar) is\n            returned only when at least one path is inside <dir>/. Rules from repo-root convention\n            files always apply. Omit for repo-wide."
    • addedInput schema / properties / paths / items
      Added value: +{
      +  "type": "string"
      +}
    • changedInput schema / properties / paths / type
      Previous value: -"string"New value: +"array"
  2. Added
  3. Removed
  4. Changed1 schema field changed
    • addedInput schema / properties / max_rules
      Added value: +{
      +  "description": "Optional maximum number of rules to return, highest severity first. Omit for all rules.",
      +  "type": "string"
      +}
  5. First observed

TDQS

A3.9/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true, destructiveHint=false, and openWorldHint=false, so safety is covered. The description usefully adds that results are severity-ordered, that a specific rule can be fetched by ID, and that root-level convention files always apply — context not present in the annotations.

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

Conciseness4/5

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

Purpose is front-loaded in the first sentence, followed by return behavior, sources, and narrowing advice in a logical order. Mild redundancy with the schema descriptions for paths, language, and max_rules costs it a point.

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

Completeness4/5

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

With an output schema present and full parameter coverage, the description supplies what remains valuable: rule sources, default result count, severity ordering, and scaling advice for large repos. Nothing critical is missing for correct 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?

Schema description coverage is 100%, so every parameter (including the nuanced paths/language/rule_id semantics) is already fully documented in the schema. The description's restatement of severity ordering and narrowing options adds little beyond that baseline.

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?

States a specific verb (Retrieve) and resource (repository coding rules and conventions), and names the exact source files (CLAUDE.md, AGENTS.md, .cursorrules, CONTRIBUTING.md). The resource is distinct from siblings context_get_urls and context_research, though the description never explicitly differentiates itself from them.

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

Usage Guidelines4/5

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

Gives concrete operational guidance: default max_rules of 20, use paths/language to narrow, pass a larger max_rules when needed, and note that large repos can have hundreds of rules. It lacks explicit 'do not use this when...' exclusions or a comparison to sibling tools, keeping it at 4.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.