the below code errors out
# Create server parameters for stdio connection
from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import stdio_client
import asyncio
from langchain_mcp_adapters.tools import load_mcp_tools
from langgraph.prebuilt import create_react_agent
from langchain_cohere import ChatCohere
server_params = StdioServerParameters(
command=“python”,
# Make sure to update to the full absolute path to your math_server.py file
args=[“server.py”],
)
async def main():
async with stdio_client(server_params) as (read, write):
async with ClientSession(read, write) as session:
# Initialize the connection
await session.initialize()
# Get tools
tools = await load_mcp_tools(session)
# Initialize Cohere LLM
cohere_llm = ChatCohere(model=“command-r-plus”)
# Create and run the agent
agent = create_react_agent(cohere_llm, tools)
agent_response = await agent.ainvoke({“messages”: [{“role”: “user”, “content”: “what’s (3 + 5) x 12?”}]})
print(agent_response)
if _name_ == “_main_”:
asyncio.run(main())
error
File “/Users/a501881320/ai-workspace/mcp/mcp/.venv/lib/python3.12/site-packages/pydantic/main.py”, line 991, in getattr
| raise AttributeError(f’{type(self).name!r} object has no attribute {item!r}')
| AttributeError: ‘V2ChatResponse’ object has no attribute ‘tool_calls’
| During task with name ‘agent’ and id ‘1d7d7f57-5aed-521f-91cd-b966e9d84f62’
±-----------------------------------
looking for suggestions