Skip to main content
Glama

guard_contract

Destructive

List, add, or remove project contract constraints so agents can recall durable rules and track session rules. Use list to review, add owner-defined rules, and remove only agent-added ones.

Instructions

List, add, or remove a project contract constraint.

Use list before acting on rules you might have forgotten, add when the owner states a durable constraint this session should keep, and remove only for a constraint this agent added. action is a required string: list, add, or remove. text is an optional string, required for add. id is an optional string, required for remove. list returns the merged contract (project plus personal layer) and a Nudge. add returns the new id and the rendered contract, or a duplicate notice. remove returns the rendered contract, or a refusal. Side effects: list creates .agent-guard/ and, when contract.json is missing, writes the twelve seed constraints. add and remove rewrite the project contract.json only. This tool never writes the personal layer (--global / ~/.config/protect-context). Removing a seed constraint is refused; the owner removes those with the CLI or /guard-contract.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "action": "<action>"
    },
    "name": "guard_contract"
  }
}

Input Schema

NameRequiredDescriptionDefault
idNoConstraint id for action "remove", such as 13-write-tests-first. String. Required for remove; ignored otherwise. Seed ids (source "seed") are refused.
textNoConstraint text for action "add". String. Required for add; ignored for list and remove. A blank or missing value is an error. The new row is stored with source "agent".
actionYesWhat to do with the project contract. Required string: "list", "add", or "remove". Any other value returns an error line.

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv3.3.1
    • addedInput schema / properties / action / description
      Added value: +"What to do with the project contract. Required string: \"list\", \"add\", or \"remove\". Any other value returns an error line."
    • addedInput schema / properties / id / description
      Added value: +"Constraint id for action \"remove\", such as 13-write-tests-first. String. Required for remove; ignored otherwise. Seed ids (source \"seed\") are refused."
    • addedInput schema / properties / text / description
      Added value: +"Constraint text for action \"add\". String. Required for add; ignored for list and remove. A blank or missing value is an error. The new row is stored with source \"agent\"."
  2. First observedv0.1.0

TDQS

A4.2/5.0
Behavior3/5

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

Annotations already flag the tool as destructive and non-read-only, and the description reinforces that with concrete side effects: `list` creates `.agent-guard/` and may write twelve seed constraints, `add`/`remove` rewrite the project `contract.json` only, and the personal layer is never touched. It also covers return values and refusal cases, so it is fully consistent with the annotations; I'm scoring 3 because this is largely restating the mutation nature the annotations already declare, though the seed-write and global-layer exclusions are genuinely new information.

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?

The purpose and per-action usage come first, followed by parameters and side effects, which is a sensible front-loading order. It runs long and duplicates schema facts about `action`/`text`/`id` requiringness, which is the main thing that could be trimmed.

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

Completeness5/5

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

For a mutating, multi-action tool the description covers side effects, refusal cases, seed vs. agent constraint distinctions, and the personal-layer boundary. An output schema exists, yet the return descriptions (merged contract + Nudge, new id, duplicate notice, refusal) still help an agent interpret outcomes.

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 required/optional status, the `action` enum, and seed-refusal behavior are already documented in structured fields. The description mostly repeats that (`text` required for `add`, `id` required for `remove`) and adds only the minor detail that new rows carry source "agent". Baseline 3 applies when the schema does the heavy lifting.

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

Purpose5/5

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

The opening sentence names three specific verbs (list/add/remove) and a precise resource (project contract constraint). It is immediately distinguishable from siblings like guard_note or guard_brief, which deal with other kinds of state, without needing to open the schema.

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

Usage Guidelines5/5

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

Usage is prescribed per action: `list` before acting on half-remembered rules, `add` when the owner states a durable constraint, and `remove` only for constraints this agent added. That is explicit when-to-use plus an exclusion, which is the strongest form of guidance available without naming a sibling alternative.

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