> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getunblocked.com/llms.txt
> Use this file to discover all available pages before exploring further.

# The context get rules tool

> Get the coding rules Unblocked extracts from a repository's instruction files

`context_get_rules` returns a repository's coding rules, so your agent can follow them before it writes or reviews code. It shares a surface with the [`unblocked context-get-rules`](https://docs.getunblocked.com/unblocked-cli/cli-query#context-get-rules) CLI command, which lists every input.

Unblocked extracts the rules from the instruction files in your repository, such as `AGENTS.md`, `CLAUDE.md`, and `.cursorrules`, including nested copies in subdirectories. See the [recognized files](https://docs.getunblocked.com/code-review/setup-and-configuration.md#custom-rules). Each rule has a severity: treat `must` as a requirement, `should` as a strong default, and `can` as optional. To change the rules, edit those files.

## Narrow the result

The tool returns the 20 highest-severity rules by default. Your agent should pass:

* `paths` — a list of the files it's changing, such as `["src/app.ts", "src/api/client.ts"]`. Rules from a nested file such as `<dir>/AGENTS.md` apply only to paths inside `<dir>/`. Root rules always apply.
* `max_rules` — a number above 20, only when the response says more rules matched and it needs them.

`task` (`code-review`, `code-generation`, or `code-questions`) narrows further.

## When your agent uses it

* Before it writes, refactors, or reviews code in a repository.
* When you ask which rules apply to a change.

## When your agent uses something else

* To learn why a rule exists, such as the pull request or discussion that introduced it, [`context_research`](https://docs.getunblocked.com/unblocked-mcp/mcp-context-research) handles it.
