feat(discord): add rename_thread action to discord_tool - #46397
Conversation
The discord_tool surface exposed 15 server-management actions but no way
to rename a thread. The REST primitive is the same `PATCH /channels/{id}`
that renames a regular channel, so the action validates that the target
is a thread type (10/11/12) before issuing the PATCH — preventing an
agent asked to "rename this thread" from accidentally renaming a top-
level text/voice/forum channel sharing a similar-looking ID.
Action shape mirrors create_thread: classified core (read/participate),
not admin, since renaming is metadata-only and bot accounts already
need MANAGE_THREADS or thread ownership for it to succeed.
Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: Approved
Adds rename_thread action to the Discord tool, allowing the model to rename an existing Discord thread via PATCH /channels/{id}.
What was changed
tools/discord_tool.py: new_rename_thread()function + added to_ACTIONS,_CORE_ACTION_NAMES, schema docs and parameters- Tests: 5 new test cases (public thread, private thread, announcement thread, refuses text channel, refuses forum channel)
Looks Good
- Defense-in-depth: probes channel type before PATCH; refuses non-thread channels (type != 10/11/12)
- Clear error messages when rejecting targets with actionable guidance
- Tests cover all thread types and the two rejection cases
- Action is part of core Discord tool (not admin-only), which is appropriate since renaming is a common user operation
- Schema and documentation updated consistently
Reviewed by Hermes Agent
|
Bump — this PR was approved a month ago but never merged, and I think it's being masked by a triage mix-up. #63330 was just closed as "already implemented and merged in #60187", but #60187 is a different feature: it's the gateway-internal auto-title path ( The gap this PR fixes still exists on v0.18.2: ask the bot in any Discord thread to "rename this thread to X" and it has no primitive — it either gives up or shells out to curl with the bot token in context. (#46396 repro is still accurate.) FWIW I applied this exact change locally on 0.18.2 ( |
|
Thanks for the focused Discord tool addition. The premise remains valid on current main: The proposed GET type probe before PATCH, non-thread refusal coverage, and core-schema registration match the reported need. GitHub reports this branch mergeable against current main. Automated hermes-sweeper review. |
Summary
Fixes #46396 — adds a
rename_threadaction todiscord_toolso agents asked to rename a thread in Discord have a first-class primitive instead of shelling out tocurl.The REST shape (
PATCH /channels/{id}with{"name": ...}) is the same call that would rename a regular text channel, so the action probes the target'stypefirst viaGET /channels/{id}and refuses with a structured error if it isn't one of the thread types (10/11/12). That defense-in-depth prevents an agent asked "rename this thread" from inadvertently renaming a top-level channel sharing a similar-looking snowflake.Classified as a core action (alongside
fetch_messages,search_members,create_thread) rather than admin, since renaming is metadata-only and bots already need MANAGE_THREADS or thread ownership for the PATCH to succeed Discord-side.Implementation
_rename_thread()function next to_create_thread()intools/discord_tool.py_ACTIONS,_ACTION_MANIFEST,_REQUIRED_PARAMS,_CORE_ACTION_NAMESdiscordcore handler now includerename_thread; admin handler unchangedTest plan
tests/tools/test_discord_tool.py::TestRenameThread: public thread (type 11), private thread (12), announcement thread (10), refusal on text channel (0), refusal on forum (15)TestRegistration::test_core_schema_actions/test_admin_schema_actionsupdated to includerename_threadin the core settest_discord_tool.pysuite passes: 95 of 95discord_core(action='rename_thread', ...)→ Discord API confirmed the new nameGenerated with Claude Code via Happy