Skip to content

fix(toolbox-langchain): avoid duplicated parameter descriptions#680

Open
WilliamK112 wants to merge 1 commit into
googleapis:mainfrom
WilliamK112:wk/fix-langchain-duplicate-param-descriptions
Open

fix(toolbox-langchain): avoid duplicated parameter descriptions#680
WilliamK112 wants to merge 1 commit into
googleapis:mainfrom
WilliamK112:wk/fix-langchain-duplicate-param-descriptions

Conversation

@WilliamK112

Copy link
Copy Markdown

Fixes googleapis/mcp-toolbox#1327.

LangChain tools currently use the core tool __doc__ as the BaseTool description. The core docstring intentionally appends an Args: section for Python introspection, but LangChain already receives parameter descriptions through args_schema, so the LLM-facing tool description duplicates every parameter description.

This changes the LangChain wrappers to use the core tool's raw _description when available, while preserving a fallback to __doc__ for compatibility with older or mocked tool objects. Regression coverage checks that the LangChain tool description no longer includes Args: while parameter descriptions remain available through args_schema.

Validation:

  • pytest tests/test_client.py tests/test_async_client.py tests/test_tools.py tests/test_async_tools.py
  • black --check src tests
  • isort --check src tests
  • MYPYPATH='./src:../toolbox-core/src' mypy --install-types --non-interactive --cache-dir=.mypy_cache/ -p toolbox_langchain

Note: the full pytest tests suite includes E2E coverage that expects a Toolbox service/version environment, so I used the non-E2E LangChain package test set above for this wrapper change.

@WilliamK112 WilliamK112 requested a review from a team as a code owner June 14, 2026 02:24
@google-cla

google-cla Bot commented Jun 14, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

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.

why there are duplicate parameters descrption in the tools ?

2 participants