Skip to main content

Crate ocp_conformance

Crate ocp_conformance 

Source
Expand description

ocp-conformance — the public Open Context Protocol conformance suite (06-context-protocol.md §3.6).

“OCP conformant” means green on this suite for your declared capability set — a checkable claim, which is what makes third-party adoption safe. run_conformance drives a provider through the protocol and returns a typed ConformanceReport with a pass/fail verdict per check and an evidence string for each, so a failure says exactly what was wrong.

The checks (all against the frozen ocp-types contracts):

  • handshake — the provider completes the handshake and reports a non-empty identity + capabilities (§3.2).
  • frame-validity — queried frames pass ocp-types validation: score in [0, 1], a non-empty title, a non-empty citation_label (§3.4 — “NEVER a bare uuid”).
  • budget-honesty — returned frames’ summed token_cost never exceeds the query budget (§3.3 — “never lies about cost”).
  • shutdown-clean — the provider tears down without error (§3.2).
  • malformed-input-tolerance — a garbage line is ignored-or-errored, never crashing the host (§3.5, task deliverable). Wire-level, so it applies to stdio providers.

The suite is deliberately adversarial: pointed at a provider that lies about costs, emits an out-of-range score, omits a citation label, or dies mid-query, the matching check fails loudly. The bundled ocp-example-docs fixture has --misbehave flags that trip each one, proving the suite catches a broken provider (task deliverable).

Structs§

CheckResult
One check’s outcome: which check, its verdict, and human-readable evidence.
ConformanceReport
The result of a conformance run: every check, against a described target.

Enums§

CheckStatus
The verdict for a single conformance check.
ProviderTarget
How to reach the provider under test. ocp-inspect builds one of these from its CLI arguments; tests build them directly.

Constants§

CHECK_BUDGET_HONESTY
CHECK_FRAME_VALIDITY
CHECK_HANDSHAKE
The stable check names, so reports and callers agree on identifiers.
CHECK_MALFORMED
CHECK_SHUTDOWN

Functions§

check_frames
Validate a query result’s frames against the ContextFrame contract (§3.4). Returns (passed, evidence). Zero frames is permitted — a provider may simply have nothing relevant.
run_conformance
Run the full conformance suite against a provider, returning a typed report. Never panics: every failure mode becomes a failing check with evidence.
sample_query
The query the suite probes every provider with — no kinds filter, so any provider is asked for its best frames (§3.3).