Description
Adds an optional aliases: t.Optional[t.List[str]] class attribute on the Python Tool base class, alongside the existing categories, status, and requires attrs. mercury/registry/push.py reads it and threads it into the toolkit_info payload posted to Thermos /registry/toolkits/upsert-complete.
Aliases are alternate display names surfaced purely for dashboard search/discovery (e.g. ["X"] for Twitter after the rebrand). Slugs and tool-execution paths are untouched. This is the second half of the hermes counterpart PR: ComposioHQ/hermes#10061.
Sets aliases = ["X"] on apps/twitter/tool.py. Once this PR lands and mercury push apps/twitter re-publishes (or scheduled CI re-publishes), the Twitter toolkit row in Thermos will carry aliases=["X"], Apollo will surface it on /api/v3/toolkits responses (via hermes#10061), and the dashboard PR will pick it up.
Backwards compatibility
- The new attribute defaults to
None on the base class.
push.py uses list(getattr(toolkit, "aliases", None) or []) — toolkits without the attribute, or with None, normalise to []. No existing toolkit changes.
- Old Mercury bundles without this attribute continue to push empty
aliases arrays once this PR lands and they're re-pushed (or simply omit the field, which Thermos's Go JSON decoder ignores — verified with the omitempty tag on the hermes side).
Files changed
| File | Change |
|---|
mercury/tools/_base/tool.py | Add aliases: t.Optional[t.List[str]] = None to the Tool class, alongside categories/status/requires |
mercury/registry/push.py | Add "aliases": list(getattr(toolkit, "aliases", None) or []) to the toolkit_info dict in _push_toolkit_complete |
apps/twitter/tool.py | Set aliases = ["X"] on the Twitter class |
Out of scope
- Tool-level aliases on individual actions — already covered by the existing
tool.alias_of machinery (see ent/registrydb/schema/tool.go in hermes).
- Adding aliases to other toolkits. Twitter is the canonical case for this PR. Future rebrands (Meta/Facebook, Block/Square, …) are one-line follow-up changes to the relevant
apps/<app>/tool.py.
How did I test this PR
ruff check + ruff format --check on the three changed files — clean
mypy --config-file config/mypy.ini on mercury/tools/_base/tool.py and mercury/registry/push.py — Success: no issues found in 2 source files
pytest tests/test_tools/ -q — 428 passed, 5 skipped
make snt — all 19 sanity checks pass (ALL SANITY CHECKS PASSED!)
python ci_checks/check_config_breaking_changes.py — No apps changed. Nothing to check. (the check only inspects config.ts, not tool.py, so adding aliases here doesn't trip it)
- Static AST verification confirmed
Twitter class has display_name = 'Twitter' and aliases = ['X'] after the edit
getattr extraction logic verified against three scenarios: aliases set, attribute missing, attribute explicitly None — all normalise correctly (["X"], [], [])
Sequencing
- ComposioHQ/hermes#10061 (storage + read path) — already up, adds the column + Apollo response field with empty defaults. No behavior change for callers, just a new optional field.
- This PR (Mercury) — Tool class attribute +
push.py plumbing + Twitter alias. Lands after #10061 so the pushed aliases value is actually persisted.
- composio_dashboard PR (separate) —
pnpm openapi:generate to pick up the field, then add "aliases" to the useClientSearch keys arrays in toolkits-listing.tsx and apps-catalog.tsx. After this, typing X in the search bar surfaces Twitter.