mcp-toolbox-sdk-python icon indicating copy to clipboard operation
mcp-toolbox-sdk-python copied to clipboard

fix(toolbox-langchain): avoid duplicated parameter descriptions

Open WilliamK112 opened this issue 5 months ago • 1 comments

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 avatar Jun 14 '26 02:06 WilliamK112

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.

google-cla[bot] avatar Jun 14 '26 02:06 google-cla[bot]