adk-python icon indicating copy to clipboard operation
adk-python copied to clipboard

Add timeout and error handling for async external service calls in toolsets

Open jmhbh opened this issue 1 year ago • 4 comments

Is your feature request related to a problem? Please describe. In mcp_toolset.py if the get_tools() method does not receive a response due to an issue with the MCP server then this can hang forever until a top level timeout kicks in. However, since there is no timeout or any error handling, the user is in the dark about the error that occurred. There should be better error handling and possibly a configurable/default timeout when handling async calls to external services.

Describe the solution you'd like Expose a configurable timeout or at least implement a default timeout for async calls to external services alongside appropriate error messages that will inform the user where exactly a failure occurred.

jmhbh avatar Sep 17 '25 23:09 jmhbh

I think this is more timeout config that should be set on MCP Session.

@jmhbh have you tried whether MCP client/server can take a timeout param?

Jacksunwei avatar Oct 24 '25 07:10 Jacksunwei

@Jacksunwei I'll take a look at this

kevinkassimo avatar Oct 27 '25 22:10 kevinkassimo

I think timeout config is already exist for StdioConnectionParams, SseConnectionParams and StreamableHTTPConnectionParam (see timeout param):

https://github.com/google/adk-python/blob/87dcb3f7ba344a2ba7d9edfc4817c9e792d90bfc/src/google/adk/tools/mcp_tool/mcp_session_manager.py#L53-L108

The only one without it is from mcp package's own StdioServerParameters, but StdioServerParameters is already a wrapper of it to add timeout field.

Have you tried setting them with a small value and see if the timeout is enforced for your case?

kevinkassimo avatar Oct 27 '25 23:10 kevinkassimo

Please try the suggestion about. If not working, feel free to re-open or create new one.

hangfei avatar Nov 08 '25 03:11 hangfei