Skip to content

useToolAllowed: whether the viewer may call one of this app's tools - #132

Merged
mgoldsborough merged 2 commits into
mainfrom
use-tool-allowed
Oct 31, 2026
Merged

mgoldsborough merged 2 commits into
mainfrom
use-tool-allowed

Conversation

@mgoldsborough

Copy link
Copy Markdown
Contributor

What. useToolAllowed(tool): boolean reads the host context's connector.allowedTools, the names of the app's own server's tools the viewer may call, and returns whether tool is among them.

Why. An app that offers a restricted control (a bulk role change, removing a blocklist entry) needs to know whether to offer it. Telling the app a role and leaving it to guess which controls that role unlocks puts the policy in two places, the host's enforcement and each app's hard-coded list, and they drift silently; it also ties every app to today's role model. A list of callable tools, computed by the host with the same decision it enforces, keeps the policy in one place: a control shown is a call that will be allowed, and a change to what a role may do reaches the app with no app change. The server still decides every call.

Degradation. A hook that waits for the host: false until the host lists the tool, and false on a host that sends no list, so a restricted control stays hidden rather than offered to someone the call would refuse. Added to the degradation table.

Release. 0.37.0, alongside #131 (the same version; whichever merges second takes the other's CHANGELOG entry). Vendored IIFE unchanged.

Tests. host-context-hooks.test.tsx: no list → false; listed → true; left out → false; follows a host-context change (as when the viewer's role changes). npm run ci: 654 pass.

@mgoldsborough
mgoldsborough marked this pull request as draft October 30, 2026 21:09
@mgoldsborough

Copy link
Copy Markdown
Contributor Author

QA Review: PR #132

Scope: 8 files, +80/−5 · worktree: supplied review worktree (creation and dependency installation skipped as requested) · reviewed: edc77d5 · CI: pending
Round: 1
Risk: LOW
Why this exists: Let apps show restricted controls using the host's callable-tool list instead of duplicating role policy.

Critical (must fix)

None.

Fix in-PR (apply mechanically — no adjudication essay expected)

None.

Suggestions (optional)

None.

What Looks Good

  • ADDITIVE React export with no changes to existing call contracts or enforcement.
  • Exact array membership defaults to false when the list is absent or malformed; the hook reuses the existing host-context subscription.
  • Four added tests exercise absent lists, membership, exclusion, and host-driven updates through the handshake and notification path.
  • Version changes agree across npm metadata and the Python client pin.

Body claims

  • ✅ The implementation and tests support the stated membership and update behavior; the degradation table is updated.
  • ✅ The vendored IIFE is unchanged in the diff, and the supplied Build check passes its freshness gate.
  • The claimed local npm run ci result of 654 passing tests cannot be independently confirmed from the supplied check summary. Test (24), lint, typecheck, build, docs, and Python checks pass; Test (22) and conformance remain pending.
  • No local suite was rerun; review used the supplied CI results and read-only source inspection.
Machine record
{
  "kind": "review",
  "pr": 132,
  "round": 1,
  "reviewed": "edc77d5f9e76af88d69e3ec4119efc7bb3e164db",
  "delta_base": null,
  "ci": "pending",
  "risk": "LOW",
  "stop_gate": "n/a",
  "verdict": "No blocking findings; eligible when CI is green.",
  "label": "eligible-on-green",
  "findings": []
}

Reviewer: Codex.

@mgoldsborough
mgoldsborough marked this pull request as ready for review October 30, 2026 21:10
@mgoldsborough mgoldsborough added the qa-reviewed QA review completed with no critical issues label Oct 30, 2026
@mgoldsborough

Copy link
Copy Markdown
Contributor Author

qa-reviewed stands on 8b8d341: the head moved from the reviewed edc77d5 only by merging main (#131) and resolving the CHANGELOG's 0.37.0 section to carry both entries. The code diff against main is identical to the one reviewed. CI on 8b8d341: all eight jobs pass.

@mgoldsborough
mgoldsborough merged commit f961e7c into main Oct 31, 2026
8 checks passed
@mgoldsborough
mgoldsborough deleted the use-tool-allowed branch October 31, 2026 02:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

qa-reviewed QA review completed with no critical issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant