@@ -2141,19 +2141,18 @@ async def test_stateless_mcp_server(client: Client, use_local_model: bool):
21412141 result = await workflow_handle .result ()
21422142 if use_local_model :
21432143 assert result == "Here are the files and directories in the allowed path."
2144- assert False
21452144
21462145
21472146@workflow .defn
21482147class McpServerStatefulWorkflow :
21492148 @workflow .run
2150- async def run (self , question : str ) -> str :
2149+ async def run (self , timeout : timedelta ) -> str :
21512150 from temporalio .contrib .openai_agents import StatefulTemporalMCPServer
21522151
21532152 async with StatefulTemporalMCPServer (
21542153 "Filesystem-Server" ,
21552154 config = ActivityConfig (
2156- schedule_to_start_timeout = timedelta ( seconds = 1 ) ,
2155+ schedule_to_start_timeout = timeout ,
21572156 start_to_close_timeout = timedelta (seconds = 30 ),
21582157 ),
21592158 ) as server :
@@ -2162,7 +2161,7 @@ async def run(self, question: str) -> str:
21622161 instructions = "Use the tools to read the filesystem and answer questions based on those files." ,
21632162 mcp_servers = [server ],
21642163 )
2165- result = await Runner .run (starting_agent = agent , input = question )
2164+ result = await Runner .run (starting_agent = agent , input = "Read the files and list them." )
21662165 return result .final_output
21672166
21682167
@@ -2211,7 +2210,7 @@ async def test_stateful_mcp_server(client: Client, use_local_model: bool):
22112210 ) as worker :
22122211 workflow_handle = await client .start_workflow (
22132212 McpServerStatefulWorkflow .run ,
2214- "Read the files and list them." ,
2213+ timedelta ( seconds = 30 ) ,
22152214 id = f"mcp-server-{ uuid .uuid4 ()} " ,
22162215 task_queue = worker .task_queue ,
22172216 execution_timeout = timedelta (seconds = 30 ),
@@ -2270,7 +2269,7 @@ def override_get_activities() -> Sequence[Callable]:
22702269 ) as worker :
22712270 workflow_handle = await client .start_workflow (
22722271 McpServerStatefulWorkflow .run ,
2273- "Read the files and list them." ,
2272+ timedelta ( seconds = 1 ) ,
22742273 id = f"mcp-server-{ uuid .uuid4 ()} " ,
22752274 task_queue = worker .task_queue ,
22762275 execution_timeout = timedelta (seconds = 30 ),
0 commit comments