-
Notifications
You must be signed in to change notification settings - Fork 252
Open
Labels
enhancementNew feature or requestNew feature or request
Description
NotImplementedError: LangChain tools with injected arguments are not supported
from typing import Dict
@create_tool('add',description="Add two numbers")
def add(a: int, b: int,state: Annotated[Dict,InjectedState],tool_call_id: Annotated[str,InjectedToolCallId]) -> Command:
"""Add two numbers"""
print("STATE",state)
print("TOOL CALL ID",tool_call_id)
if tool_call_id is None:
tool_call_id = ""
messages = state.get("messages", []) if state else []
tool_message = ToolMessage(name="add",content=f"The sum of {a} and {b} is {a+b}",tool_call_id=tool_call_id)
return Command(
update={
'messages': messages +[tool_message]
}
)
add_tool = to_fastmcp(add)
mcp = FastMCP("Add",tools=[add_tool])
import asyncio
server_task = asyncio.create_task(mcp.run_async(transport="sse",port=8762))
Pl1sM3rC, rohithbojja, Pion6 and streamnsight
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request