Skip to content

Commit fa00eb7

Browse files
actually format the args into a start event instance (#19001)
1 parent 0fb1351 commit fa00eb7

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

llama-index-integrations/tools/llama-index-tools-mcp/llama_index/tools/mcp/utils.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,14 @@ def workflow_as_mcp(
103103
async def _workflow_tool(run_args: StartEventCLS, context: Context) -> Any:
104104
# Handle edge cases where the start event is an Event or a BaseModel
105105
# If the workflow does not have a custom StartEvent class, then we need to handle the event differently
106-
context.session
106+
107107
if isinstance(run_args, Event) and workflow._start_event_class != StartEvent:
108108
handler = workflow.run(start_event=run_args)
109109
elif isinstance(run_args, BaseModel):
110110
handler = workflow.run(**run_args.model_dump())
111+
elif isinstance(run_args, dict):
112+
start_event = StartEventCLS.model_validate(run_args)
113+
handler = workflow.run(start_event=start_event)
111114
else:
112115
raise ValueError(f"Invalid start event type: {type(run_args)}")
113116

llama-index-integrations/tools/llama-index-tools-mcp/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ dev = [
2929

3030
[project]
3131
name = "llama-index-tools-mcp"
32-
version = "0.2.4"
32+
version = "0.2.5"
3333
description = "llama-index tools mcp integration"
3434
authors = [{name = "Chojan Shang", email = "[email protected]"}]
3535
requires-python = ">=3.10,<4.0"

0 commit comments

Comments
 (0)