Skip to content

fix(tools): unify LangChain tool names with MCP — fix doc/tool drift from #2237 - #2239

Closed
HongmingWang-Rabbit wants to merge 1 commit into
stagingfrom
fix/unify-tool-names-with-mcp
Closed

fix(tools): unify LangChain tool names with MCP — fix doc/tool drift from #2237#2239
HongmingWang-Rabbit wants to merge 1 commit into
stagingfrom
fix/unify-tool-names-with-mcp

Conversation

@HongmingWang-Rabbit

Copy link
Copy Markdown
Contributor

Summary

Follow-up fix for #2237 (just merged). That PR injected the A2A and HMA tool docs into the system prompt — necessary for workers to know how to use platform tools. But it shipped MCP-world tool names (`delegate_task`, `check_task_status`, `recall_memory`) while LangChain runtimes only had the older names (`delegate_to_workspace`, `check_delegation_status`, `search_memory`). Right now in production, LangChain workers see docs telling them to call tools that don't exist.

This PR lands the harmonization that should have shipped alongside #2237. After this PR, both MCP and LangChain runtimes share a single tool naming so the platform-injected docs are accurate everywhere.

Renames (per CP review Issues 2 + 3)

LangChain @tool (old) LangChain @tool (new) Matches MCP server Tool in docs
`delegate_to_workspace` `delegate_task_async`
`check_delegation_status` `check_task_status`
`search_memory` `recall_memory`
(missing) `delegate_task` (NEW, sync)

New tool: sync `delegate_task` (closes Issue 3)

Wraps `a2a_tools.tool_delegate_task` as a LangChain `@tool`. Returns the peer's response text directly — no `task_id` polling. Use for QUICK questions; use `delegate_task_async` + `check_task_status` for longer work.

Files touched

All under `workspace/`:

  • `builtin_tools/delegation.py` — rename + new `delegate_task`
  • `builtin_tools/memory.py` — `search_memory` → `recall_memory`
  • `adapter_base.py`, `main.py` — register all 7 tools (was 6)
  • `coordinator.py`, `shared_runtime.py`, `policies/routing.py` — update prompt-text references
  • `tests/conftest.py` — module mocks include `delegate_task`
  • `tests/test_delegation.py`, `tests/test_memory.py`, `tests/test_coordinator_routing.py` — name updates
  • `tests/test_prompt.py` — 2 new alignment regression tests that fail if docs drift from `@tool` symbols again

Tests

`WORKSPACE_ID=test pytest workspace/tests/` — 1225 passed, 2 xfailed.

Why this needed to be its own PR

#2237 reached the merge queue while I was still extending the branch. By the time I tried to add the harmonization, #2237 had already landed. Shipping as a follow-up to close the regression window ASAP.

Refs

🤖 Generated with Claude Code

Addresses CP review Issues 2 + 3 from 2026-04-28: the LangChain runtimes
exposed `delegate_to_workspace` / `check_delegation_status` /
`search_memory` while the MCP server (a2a_mcp_server.py) and the docs
in get_a2a_instructions / get_hma_instructions used `delegate_task` /
`check_task_status` / `recall_memory`. Workers running on
LangGraph/CrewAI/LangChain saw docs telling them to call tools that
didn't exist, while MCP runtimes (claude-code) had matching docs.
The previous PR (#2237) made the situation worse by injecting
MCP-world docs as the default — half the runtimes would now have
been actively misled.

The fix: rename LangChain @tool functions to match MCP tool names.
After this PR, both runtime worlds share a single tool naming, and
the platform-injected docs are accurate everywhere.

Renames:
  delegate_to_workspace   -> delegate_task_async
  check_delegation_status -> check_task_status
  search_memory           -> recall_memory

New tool (closes Issue 3 — sync delegation was missing for LangChain):
  delegate_task — sync wrapper around a2a_tools.tool_delegate_task,
  returns the peer's response text directly (no task_id polling).
  Use this for QUICK questions; use delegate_task_async +
  check_task_status for longer-running work.

Files touched (all under workspace/):
  builtin_tools/delegation.py — rename + add sync delegate_task
  builtin_tools/memory.py     — rename search_memory -> recall_memory
  adapter_base.py             — register all 7 tools (was 6)
  main.py                     — same
  coordinator.py              — system-prompt text + import alias
  shared_runtime.py           — peer-section instruction text
  policies/routing.py         — routing description text
  tests/conftest.py           — module mocks include delegate_task
  tests/test_delegation.py    — name updates
  tests/test_memory.py        — name updates
  tests/test_coordinator_routing.py — name updates
  tests/test_prompt.py        — 2 new alignment regression tests:
    test_a2a_doc_lists_unified_tool_names
    test_hma_doc_lists_unified_tool_names
  These pin doc/tool alignment so a future drift breaks CI.

Tests: 1225 pass, 2 xfailed (pre-existing).

Together with the A2A/HMA injection in this same branch (commit
448709f), the platform now ships:
  - tool docs that ARE in the system prompt
  - tool names in those docs that match the actual @tool symbols
  - sync + async + poll variants for both runtime worlds

Refs: CP review Issues 1, 2, 3, 5 (Issue 4 noted, deferred — no
platform timeout for coordinator-level execution; could be by design).
@HongmingWang-Rabbit

Copy link
Copy Markdown
Contributor Author

Superseded by feat/platform-tool-registry — that PR does the same rename PLUS the registry-driven single-source-of-truth refactor the user asked for.

auto-merge was automatically disabled April 29, 2026 00:05

Pull request was closed

@molecule-ai
molecule-ai Bot deleted the fix/unify-tool-names-with-mcp branch May 20, 2026 06:22
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.

1 participant