Skip to content

[transforms] Per-session dynamic tool visibility #65

Open

Description

@Shreyavemana

Depends on: Issue #61

Summary

Let a tool start hidden and be enabled or disabled per session from a handler, for example to unlock admin tools after login.

Reference

  • ts:core/tool.ts: visibility?: 'visible' | 'hidden', defaultVisible.
  • ts:core/types.ts: ctx.enableTools(names), ctx.disableTools(names).
  • ts:core/server.ts:
    • sessionIsolationKey(transportSessionId, verifiedSubject).
    • With no transport session id, enableTools logs a warning and does nothing.
    • Unknown tool names are warned about and skipped.
  • ts:core/transforms/visibility/ (visibility.transform.ts, session-store.ts, with TTL and LRU eviction).

Scope

  • visibility / default_visible on @tool.
  • ExecutionContext.enable_tools(names) and disable_tools(names).
  • VisibilityTransform plus a SessionVisibilityStore with TTL and max-entries eviction.
  • Emit notifications/tools/list_changed when visibility changes, where the transport supports it.
  • Decision required: Python's default protocol era (auto) is sessionless, so the TypeScript rule of "no-op without a session id" would no-op by default. Pick one before implementing, and record it in the PR:
    • (a) match TypeScript and document that visibility needs a sessionful era;
    • (b) fall back to the verified token subject;
    • (c) another key.

Acceptance criteria

  • Hidden tools are absent from tools/list and tools/call rejects them as unknown, until they are enabled for that session.
  • Two concurrent sessions are isolated.
  • A session id supplied by a client cannot read another session's state; the key includes the verified subject.
  • Expired sessions are evicted (fake clock).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions