You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using tools loaded via loadMcpTools() with createReactAgent from @langchain/langgraph using ChatXAI or ChatDeepSeek, the system throws a TypeError: parameters.describe is not a function.
Reproduction Steps
Steps to reproduce the behavior:
Create a client using new Client() from @modelcontextprotocol/sdk/client.
Connect to a tool server via StdioClientTransport, e.g., tavily-mcp.
Load tools using loadMcpTools('tavily-mcp', client).
Pass these tools directly to createReactAgent() as-is, choose ChatDeepSeek or ChatXAI as the LLM.
Invoke the compiled agent workflow and observe the crash.
Expected Behavior
The tools should be accepted by createReactAgent() without requiring manual conversion of the parameters field to Zod schema.
Actual Behavior
Runtime error is thrown:
[Nest] 19888 - 29/04/2025, 6:06:13 pm ERROR TypeError: Cannot read properties of undefined (reading 'typeName')
at parseDef (C:\Users\Admin\Documents\red\p1\demo\node_modules\openai\src\_vendor\zod-to-json-schema\parseDef.ts:102:53)
at zodToJsonSchema (C:\Users\Admin\Documents\red\p1\demo\node_modules\openai\src\_vendor\zod-to-json-schema\zodToJsonSchema.ts:26:13)
at zodToJsonSchema (C:\Users\Admin\Documents\red\p1\demo\node_modules\openai\src\helpers\zod.ts:16:26)
at zodFunction (C:\Users\Admin\Documents\red\p1\demo\node_modules\openai\src\helpers\zod.ts:119:21)
at _convertToOpenAITool (C:\Users\Admin\Documents\red\p1\demo\node_modules\@langchain\xai\node_modules\@langchain\openai\dist\utils\tools.cjs:22:50)
at _convertChatOpenAIToolTypeToOpenAITool (C:\Users\Admin\Documents\red\p1\demo\node_modules\@langchain\xai\node_modules\@langchain\openai\dist\chat_models.cjs:461:48)
at C:\Users\Admin\Documents\red\p1\demo\node_modules\@langchain\xai\node_modules\@langchain\openai\dist\chat_models.cjs:1330:19
at Array.map (<anonymous>)
at ChatXAI.bindTools (C:\Users\Admin\Documents\red\p1\demo\node_modules\@langchain\xai\node_modules\@langchain\openai\dist\chat_models.cjs:1328:26)
at createReactAgent (C:\Users\Admin\Documents\red\p1\demo\node_modules\@langchain\langgraph\src\prebuilt\react_agent_executor.ts:469:3)
Stack trace points to internal LangGraph validation when handling tools.
Bug Description
When using tools loaded via
loadMcpTools()
withcreateReactAgent
from@langchain/langgraph
using ChatXAI or ChatDeepSeek, the system throws aTypeError: parameters.describe is not a function
.Reproduction Steps
Steps to reproduce the behavior:
new Client()
from@modelcontextprotocol/sdk/client
.StdioClientTransport
, e.g.,tavily-mcp
.loadMcpTools('tavily-mcp', client)
.createReactAgent()
as-is, choose ChatDeepSeek or ChatXAI as the LLM.Expected Behavior
The tools should be accepted by
createReactAgent()
without requiring manual conversion of theparameters
field to Zod schema.Actual Behavior
Runtime error is thrown:
Stack trace points to internal LangGraph validation when handling tools.
Environment
@langchain/langgraph
: 0.2.65@langchain/mcp-adapters
: 0.4.2tavily-mcp
(https://docs.tavily.com/documentation/mcp#cursor)stdio
Additional Context
None
Possible Solution
none
The text was updated successfully, but these errors were encountered: