Skip to content
Back to skills

Resultseal Contracts

ASecurity

Write, validate, and debug ResultSeal contracts (.resultseal/contracts/<tool>.json) that guard MCP tool results via PostToolUse hooks. Use when an agent hallucinates from empty arrays ([]), empty objects ({}), Slack/API HTTP 200 ok:false errors, MCP isError:true responses, missing required fields, or stale tool outputs, or when explaining why ResultSeal blocked a tool result.

  • 5 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 1, 2026
ai-agentsbashgitapi

Works with

  • cli
  • api
  • mcp

Security analysis

A100/100

Scanned December 6, 2026

npx -y skills add sx4im/resultseal --skill resultseal-contracts --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Resultseal Contracts?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Resultseal Contracts
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/sx4im-resultseal-contracts/badge)](https://www.skillsdirectory.com/skills/sx4im-resultseal-contracts)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: resultseal-contracts
description: Write, validate, and debug ResultSeal contracts (.resultseal/contracts/<tool>.json) that guard MCP tool results via PostToolUse hooks. Use when an agent hallucinates from empty arrays ([]), empty objects ({}), Slack/API HTTP 200 ok:false errors, MCP isError:true responses, missing required fields, or stale tool outputs, or when explaining why ResultSeal blocked a tool result.
---

# ResultSeal contracts for MCP tools

The ResultSeal plugin runs after every MCP tool call. When
`.resultseal/contracts/<tool_name>.json` (or `.yaml`) exists for the tool, the
hook checks the result against it and blocks results that are empty, errored
or missing required fields. Tools without a contract are not checked.

## Add a contract for a tool

1. Find the exact tool name. MCP tools are named `mcp__<server>__<tool>`, for
   example `mcp__crm__get_customer`. The file name must match it exactly.
2. Prefer `resultseal init` to scaffold a validated v1 contract directly into
   `.resultseal/contracts/<tool_name>.json` instead of hand-writing boilerplate:

```bash
# List built-in starter templates (github-issue, github-pr, postgres-query, http-json, not-found)
resultseal init --list-templates

# Start from a built-in template
resultseal init --template github-issue --tool mcp__github__get_issue

# Or infer required_fields from one or more real non-empty tool responses (JSON, YAML, or stdin '-')
resultseal init sample.json --tool mcp__crm__get_customer
```

   Sample inference is fail-closed (errored or empty samples exit `2`), refuses
   to overwrite existing contracts without `--force`, and supports `--stdout`
   to preview or `--out PATH` for another location. If `resultseal` is not on
   `PATH`, run `uvx resultseal init ...` or install it with
   `pipx install resultseal`.

3. If you write or edit `.resultseal/contracts/<tool_name>.json` manually, pick
   only the top-level fields the answer depends on:

```json
{
  "schema_version": "1",
  "claim_type": "found",
  "required_fields": ["customer_id", "name"],
  "freshness": {"mode": "not_required"},
  "source_ref": "mcp://crm",
  "target_ref": "crm:customer"
}
```

4. Validate it: `resultseal validate .resultseal/contracts/<tool_name>.json`.
   The command must print `valid (contract)`. If the CLI is missing, run
   `uvx resultseal validate ...` instead, or install it with
   `pipx install resultseal`.

## Choosing fields

- `claim_type`: use `found` or `read_complete` for lookups and reads. Use
  `not_found` only when the server returns an explicit absence value, and set
  `not_found_sentinel` to that value (for example `"NOT_FOUND"`); an empty
  list or object never proves absence.
- `required_fields`: top-level keys of the result object. A JSON document
  returned as text content is parsed before the check.
- `freshness`: keep `{"mode": "not_required"}`. MCP results carry no source
  version or observation time, so `source_version` mode always blocks and
  `max_age_seconds` cannot detect staleness in a hook.
- `effect_observed` / `task_complete` with `effect_evidence_required: true`
  always block in the hook, because MCP results carry no evidence references.
- `source_ref` and `target_ref` are labels for the decision record. The hook
  copies them into the observation, so they cannot mismatch, and uses the
  tool name for either one that is missing. Keep both so that
  `resultseal validate` accepts the contract.

## When a result is blocked

The hook reports the truth state and reason codes. Do not state the blocked
result as fact. Explain the code to the user and retry or ask for direction:

| Reason code | Meaning |
|---|---|
| `EMPTY_WITHOUT_NOT_FOUND_SENTINEL` | Empty result; it does not prove the record is absent. |
| `PROTOCOL_CONFLICT` | The tool set `isError: true`; its content is an error, not an answer. |
| `MISSING_REQUIRED_FIELD` | A field the contract requires is missing. |
| `UNVERIFIED_EFFECT` | An effect claim without evidence references. |

The reason code list and promotion rules are in
https://github.com/sx4im/resultseal/blob/master/docs/specs/PROMOTION_RULES.md.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.