Skip to content

feat(decisioning): advertise_all kwarg + handler.get_advertised_tools#529

Merged
bokelley merged 2 commits into
mainfrom
bokelley/advertise-all-default
May 4, 2026
Merged

feat(decisioning): advertise_all kwarg + handler.get_advertised_tools#529
bokelley merged 2 commits into
mainfrom
bokelley/advertise-all-default

Conversation

@bokelley
Copy link
Copy Markdown
Contributor

@bokelley bokelley commented May 4, 2026

Closes #519.

Summary

  • Add advertise_all: bool = False kwarg to create_adcp_server_from_platform (matching the existing flag on serve()).
  • Add handler.get_advertised_tools(advertise_all=None) -> frozenset[str] — returns the same set tools/list emits at serve time. Default reads the configured advertise_all; the kwarg lets adopters override per-call.
  • Plumb the new flag through serve()create_adcp_server_from_platformPlatformHandler.__init__, stored on the instance as _advertise_all.

Why

Salesagent migration feedback (item #14): a fresh MockSellerPlatform with 5 implemented methods shows ~50 entries in handler.advertised_tools (the class-level universe). Buyers see only the per-specialism intersection (~10 entries for sales-only). Adopters had no way to inspect that effective set without standing up a real server.

Test plan

  • 4 new tests in test_decisioning_serve.py:
    • default returns the per-specialism filtered set, materially smaller than the class universe
    • return type is frozenset
    • advertise_all=True at factory time stores on handler
    • default is False, matching serve()
  • Full test_decisioning_serve.py + handler.py + handler_shims.py suite — 106 passed
  • ruff, mypy clean
  • All pre-commit hooks pass

Notes for reviewers

The _is_method_overridden filter is essentially a no-op for PlatformHandler subclasses — the base class shims technically "override" every spec method, so the override detection returns True for all of them. The real shrink (~50 → ~10) comes from advertised_tools_for_instance (specialism intersection), which get_advertised_tools includes via get_tools_for_handler. Tests assert the size shrink rather than specific override-vs-not entries, since the practical filter is the specialism one.

🤖 Generated with Claude Code

bokelley and others added 2 commits May 3, 2026 21:21
…#519)

Surfaces ``advertise_all`` on ``create_adcp_server_from_platform`` for
parity with ``serve()``, and adds a ``handler.get_advertised_tools()``
inspection method that returns the same set ``tools/list`` would emit at
serve time — without standing up a network port.

Salesagent migration feedback #14: a fresh ``MockSellerPlatform`` (5
methods) shows ~50 entries in ``handler.advertised_tools`` (the
class-level universe) but only ~10 actually advertise on the wire after
the per-instance specialism filter. The new method makes the effective
set readable from the handler instance directly, with the
``advertise_all`` flag controllable at factory time and overridable
per-call.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds a test that constructs a handler with advertise_all=False and
verifies passing advertise_all=True on the method call returns a wider
set than the call without the override. Closes the only branch in the
method body not previously covered.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@bokelley bokelley merged commit 8b1b384 into main May 4, 2026
15 checks passed
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.

decisioning: surface advertise_all=False on create_adcp_server_from_platform

1 participant