Role schema
Pattern syntax
Patterns match against dot-separated tool paths:| Pattern | Matches | Does not match |
|---|---|---|
github.issues.* | github.issues.create, github.issues.list | github.repos.search |
github.** | github.issues.create, github.repos.search | linear.issues.list |
gmail.messages.read | gmail.messages.read only | gmail.messages.list |
* | Everything | — |
*matches exactly one segment**matches zero or more segments at any depth
Example roles
Developer — full GitHub access, read-only Slack:How filtering works
The policy engine provides two functions from@toolshed/policy:
filterToolsByRole(tools, role)
Returns only the tools whose paths match at least one pattern in the role:
matchPattern(toolPath, pattern)
Tests whether a single tool path matches a single pattern:
Annotation resolution
The policy package also resolves whether a tool requires approval:- OpenAPI tools:
metadata.httpMethod— GET, HEAD, OPTIONS are safe - GraphQL tools:
metadata.operationType— queries are safe, mutations require approval - MCP tools:
metadata.mcpAnnotations.destructiveHint - Plugin tools: falls back to the explicit
destructiveflag