Skip to content

Change timeout for MCP Server (ADK enforces 5 seconds) #1463

Open
@Allena101

Description

@Allena101

So i am using u/playwright/mcp@latest mcp server and got it working eventually. The issue i have now is that i get timeout error often:

{"error": "Timed out while waiting for response to ClientRequest. Waited 5.0 seconds."}
I asked on their repo and they said that the default is not 5 seconds and ADT set that limit itself.
The ADK documentation says:
connection_params: The connection parameters to the MCP server. Can be:
StdioConnectionParams for using local mcp server (e.g. using npx or
python3); or SseConnectionParams for a local/remote SSE server; or
StreamableHTTPConnectionParams for local/remote Streamable http
server. Note, StdioServerParameters is also supported for using local
mcp server (e.g. using npx or python3 ), but it does not support
timeout, and we recommend to use StdioConnectionParams instead when
timeout is needed.

But i cant figure out how to change the enforced 5 second limit.
The commented out options dont work:
root_agent = LlmAgent(
    model="gemini-2.0-flash",
    name="browser_MCP_Agent",
    instruction="You search the web in order to answer the user's question.",
    tools=[
        MCPToolset(
            connection_params=StdioServerParameters(
                command="npx",
                args=[
                    "@playwright/mcp@latest",
                    "--browser", "brave",
                    "--headless",
                    "--vision",
                    # "--timeout", "60"
                ],
                # timeout=60,
            )
        ),
    ],
)
root_agent = LlmAgent(
    model="gemini-2.0-flash",
    name="browser_MCP_Agent",
    instruction="You search the web in order to answer the user's question.",
    tools=[
        MCPToolset(
            connection_params=StdioServerParameters(
                command="npx",
                args=[
                    "@playwright/mcp@latest",
                    "--browser", "brave",
                    "--headless",
                    "--vision",
                    # "--timeout", "60"
                ],
                # timeout=60,
            )
        ),
    ],
)

Metadata

Metadata

Assignees

Labels

bot_triagedquestionFurther information is requestedtoolsIssues related to tools

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions