Skip to content

feat: add tool gating examples#20

Merged
rlippmann merged 2 commits into
mainfrom
tool-gating
Jun 29, 2026
Merged

feat: add tool gating examples#20
rlippmann merged 2 commits into
mainfrom
tool-gating

Conversation

@rlippmann

Copy link
Copy Markdown
Owner

Summary

Adds generic Python and TypeScript tool-gating examples.

The examples demonstrate that Context Compiler authoritative state determines which tools are exposed by the host and whether those tools may execute. The host owns tool registration and execution, while Context Compiler owns the policy state that controls tool availability.

Why

Tool gating is a distinct enforcement point.

These examples show that restricted tools are removed from the available tool surface when not authorized. Access decisions are enforced by the host using authoritative Context Compiler state rather than prompt instructions, user claims, or model compliance.

The examples use a calendar administration domain to demonstrate observable changes in tool availability and execution behavior as authoritative state changes.

Example metadata

  • Enforcement point: tool gating
  • Domain: calendar administration
  • Technology/runtime: generic Python, generic TypeScript
  • Example type: minimal example
  • Does this use directive drafter? should normally be no: no
  • Does this derive state from model output? must be no for primary examples: no

Checklist

  • Repository scaffolding / governance change
  • One primary enforcement point
  • Explicit authoritative state
  • No model-derived state mutation
  • Adversarial stub or equivalent test
  • Observable runtime behavior change
  • Domain vocabulary is natural
  • Framework is secondary to the enforcement point
  • Docs updated
  • Tests/smoke checks added where practical

Notes

Both implementations demonstrate:

  • authorized state exposes the calendar administration tool
  • authorized state allows tool execution
  • absent state hides the tool and blocks execution
  • prohibited state hides the tool and blocks execution
  • adversarial requests do not enable gated tools
  • contradictory directives produce clarification behavior rather than silent overwrite

The examples intentionally gate tool discovery as well as execution. Unauthorized tools are not exposed by the host, and direct invocation attempts are blocked even if a caller bypasses discovery.

TypeScript validation scripts were updated so the new example participates in repository validation.

@rlippmann
rlippmann merged commit aad82f7 into main Jun 29, 2026
5 checks passed
@rlippmann
rlippmann deleted the tool-gating branch June 29, 2026 05:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant