-
Notifications
You must be signed in to change notification settings - Fork 343
Labels
Description
Package (Required)
- langchain-google-genai
- langchain-google-vertexai
- langchain-google-community
- Other / not sure / general
Checked other resources
- I added a descriptive title to this issue
- I searched the LangChain documentation and API reference (linked above)
- I used the GitHub search to find a similar issue and didn't find it
- I am sure this is a bug and not a question or request for help
Example Code (Python)
mcp_client = MultiServerMCPClient(
{
"ne04j": {
"transport": "stdio", # Local subprocess communication
"command": "./neo4j-mcp",
"args": [],
"env": {
"NEO4J_URI": "neo4j://127.0.0.1:7687",
"NEO4J_USERNAME": "neo4j",
"NEO4J_PASSWORD": "asdfasdf",
"NEO4J_DATABASE": "neo4j",
"NEO4J_READ_ONLY": "true", # Optional: disables write tools
"NEO4J_TELEMETRY": "false" # Optional: disables telemetry
}
}
}
)
model = init_chat_model(
"google_genai:gemini-2.5-flash-lite",
temperature=0.1, # fine-tune as needed
api_key=settings.GOOGLE_API_KEY
)
mcp_tools = await mcp_client.get_tools()
llm_agent = create_agent(
model=model,
tools=mcp_tools
)
response = await llm_agent.ainvoke({
"messages": [{"role": "user", "content": "List 3 Neo4j read-only tools available." }]
})
print("LLM Agent response:", response)Error Message and Stack Trace (if applicable)
Traceback (most recent call last):
File "/Users/clowman/Documents/Code/CISO_Dashboard/.venv/lib/python3.13/site-packages/uvicorn/protocols/http/h11_impl.py", line 403, in run_asgi
result = await app( # type: ignore[func-returns-value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
self.scope, self.receive, self.send
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/Users/clowman/Documents/Code/CISO_Dashboard/.venv/lib/python3.13/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in __call__
return await self.app(scope, receive, send)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/clowman/Documents/Code/CISO_Dashboard/.venv/lib/python3.13/site-packages/fastapi/applications.py", line 1134, in __call__
await super().__call__(scope, receive, send)
File "/Users/clowman/Documents/Code/CISO_Dashboard/.venv/lib/python3.13/site-packages/starlette/applications.py", line 113, in __call__
await self.middleware_stack(scope, receive, send)
File "/Users/clowman/Documents/Code/CISO_Dashboard/.venv/lib/python3.13/site-packages/starlette/middleware/errors.py", line 186, in __call__
raise exc
File "/Users/clowman/Documents/Code/CISO_Dashboard/.venv/lib/python3.13/site-packages/starlette/middleware/errors.py", line 164, in __call__
await self.app(scope, receive, _send)
File "/Users/clowman/Documents/Code/CISO_Dashboard/.venv/lib/python3.13/site-packages/starlette/middleware/cors.py", line 85, in __call__
await self.app(scope, receive, send)
File "/Users/clowman/Documents/Code/CISO_Dashboard/.venv/lib/python3.13/site-packages/starlette/middleware/exceptions.py", line 63, in __call__
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
File "/Users/clowman/Documents/Code/CISO_Dashboard/.venv/lib/python3.13/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
raise exc
File "/Users/clowman/Documents/Code/CISO_Dashboard/.venv/lib/python3.13/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
await app(scope, receive, sender)
File "/Users/clowman/Documents/Code/CISO_Dashboard/.venv/lib/python3.13/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
await self.app(scope, receive, send)
File "/Users/clowman/Documents/Code/CISO_Dashboard/.venv/lib/python3.13/site-packages/starlette/routing.py", line 716, in __call__
await self.middleware_stack(scope, receive, send)
File "/Users/clowman/Documents/Code/CISO_Dashboard/.venv/lib/python3.13/site-packages/starlette/routing.py", line 736, in app
await route.handle(scope, receive, send)
File "/Users/clowman/Documents/Code/CISO_Dashboard/.venv/lib/python3.13/site-packages/starlette/routing.py", line 290, in handle
await self.app(scope, receive, send)
File "/Users/clowman/Documents/Code/CISO_Dashboard/.venv/lib/python3.13/site-packages/fastapi/routing.py", line 124, in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
File "/Users/clowman/Documents/Code/CISO_Dashboard/.venv/lib/python3.13/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
raise exc
File "/Users/clowman/Documents/Code/CISO_Dashboard/.venv/lib/python3.13/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
await app(scope, receive, sender)
File "/Users/clowman/Documents/Code/CISO_Dashboard/.venv/lib/python3.13/site-packages/fastapi/routing.py", line 110, in app
response = await f(request)
^^^^^^^^^^^^^^^^
File "/Users/clowman/Documents/Code/CISO_Dashboard/.venv/lib/python3.13/site-packages/fastapi/routing.py", line 390, in app
raw_response = await run_endpoint_function(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...<3 lines>...
)
^
File "/Users/clowman/Documents/Code/CISO_Dashboard/.venv/lib/python3.13/site-packages/fastapi/routing.py", line 289, in run_endpoint_function
return await dependant.call(**values)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/clowman/Documents/Code/CISO_Dashboard/backend_api/server.py", line 131, in test_endpoint
response = await llm_agent.ainvoke({
^^^^^^^^^^^^^^^^^^^^^^^^^
"messages": [{"role": "user", "content": "List 3 Neo4j read-only tools available." }]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
})
^^
File "/Users/clowman/Documents/Code/CISO_Dashboard/.venv/lib/python3.13/site-packages/langgraph/pregel/main.py", line 3137, in ainvoke
async for chunk in self.astream(
...<29 lines>...
chunks.append(chunk)
File "/Users/clowman/Documents/Code/CISO_Dashboard/.venv/lib/python3.13/site-packages/langgraph/pregel/main.py", line 2956, in astream
async for _ in runner.atick(
...<13 lines>...
yield o
File "/Users/clowman/Documents/Code/CISO_Dashboard/.venv/lib/python3.13/site-packages/langgraph/pregel/_runner.py", line 304, in atick
await arun_with_retry(
...<15 lines>...
)
File "/Users/clowman/Documents/Code/CISO_Dashboard/.venv/lib/python3.13/site-packages/langgraph/pregel/_retry.py", line 137, in arun_with_retry
return await task.proc.ainvoke(task.input, config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/clowman/Documents/Code/CISO_Dashboard/.venv/lib/python3.13/site-packages/langgraph/_internal/_runnable.py", line 705, in ainvoke
input = await asyncio.create_task(
^^^^^^^^^^^^^^^^^^^^^^^^^^
step.ainvoke(input, config, **kwargs), context=context
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/Users/clowman/Documents/Code/CISO_Dashboard/.venv/lib/python3.13/site-packages/langgraph/_internal/_runnable.py", line 473, in ainvoke
ret = await self.afunc(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/clowman/Documents/Code/CISO_Dashboard/.venv/lib/python3.13/site-packages/langchain/agents/factory.py", line 1148, in amodel_node
response = await _execute_model_async(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/clowman/Documents/Code/CISO_Dashboard/.venv/lib/python3.13/site-packages/langchain/agents/factory.py", line 1116, in _execute_model_async
model_, effective_response_format = _get_bound_model(request)
~~~~~~~~~~~~~~~~^^^^^^^^^
File "/Users/clowman/Documents/Code/CISO_Dashboard/.venv/lib/python3.13/site-packages/langchain/agents/factory.py", line 1049, in _get_bound_model
request.model.bind_tools(
~~~~~~~~~~~~~~~~~~~~~~~~^
final_tools, tool_choice=request.tool_choice, **request.model_settings
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
),
^
File "/Users/clowman/Documents/Code/CISO_Dashboard/.venv/lib/python3.13/site-packages/langchain_google_genai/chat_models.py", line 1237, in bind_tools
genai_tools = [tool_to_dict(convert_to_genai_function_declarations(tools))]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^
File "/Users/clowman/Documents/Code/CISO_Dashboard/.venv/lib/python3.13/site-packages/langchain_google_genai/_function_utils.py", line 179, in convert_to_genai_function_declarations
fd = _format_to_gapic_function_declaration(tool)
File "/Users/clowman/Documents/Code/CISO_Dashboard/.venv/lib/python3.13/site-packages/langchain_google_genai/_function_utils.py", line 201, in _format_to_gapic_function_declaration
return _format_base_tool_to_function_declaration(tool)
File "/Users/clowman/Documents/Code/CISO_Dashboard/.venv/lib/python3.13/site-packages/langchain_google_genai/_function_utils.py", line 238, in _format_base_tool_to_function_declaration
elif issubclass(tool.args_schema, BaseModelV1):
~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen abc>", line 123, in __subclasscheck__
TypeError: issubclass() arg 1 must be a class
During task with name 'model' and id 'e48f8723-a7e5-18e9-da79-df542a1f29a0'Description
I'm trying to run a call to gemini and pass a neo4j tool for the local server found here. I'm new to this so I could have some configuration incorrect, but as far as I can tell everything is correct and it seems like there's an error buried in the google_genai package. My guess is maybe it expects for the args in the mcp initialization to not be empty? I don't need any since I'm just running a binary
langchain 1.0.7
langchain-mcp-adapters 0.1.13