Skip to content

Browser context closes after each tool call and human input requested despite toggle disabled in Playwright MCP server #5165

@avishekjana-89

Description

@avishekjana-89

Describe the bug

When using the Playwright MCP server with Flowise's Custom MCP tool, two critical issues occur:

  1. Browser context gets closed after each tool calling, causing subsequent browser operations to fail
  2. Human input is requested for each tool call even when agentSelectedToolRequiresHumanInput is set to false

To Reproduce

  1. Configure Custom MCP tool with Playwright MCP server using SSE transport
  2. Set up agent with browser actions like browser_navigate, browser_press_key, etc.
  3. Set agentSelectedToolRequiresHumanInput: false in tool configuration
  4. Execute multiple browser operations in sequence
  5. Observe browser context closure and human input prompts

Expected behavior

  1. Browser context should persist across multiple tool calls within the same session

  2. No human input should be requested when agentSelectedToolRequiresHumanInput is false

  3. Sequential browser operations should work without "No open pages available" errors

Screenshots

No response

Flow

{"nodes":[{"id":"startAgentflow_0","type":"agentFlow","position":{"x":-27,"y":99},"data":{"label":"Start","name":"startAgentflow","version":1.1,"type":"Start","category":"Agent Flows","description":"Starting point of the agentflow","baseClasses":["Start"],"color":"#7EE787","hideInput":true,"inputs":{"startInputType":"chatInput","formTitle":"","formDescription":"","formInputTypes":"","startEphemeralMemory":"","startState":"","startPersistState":""},"filePath":"/usr/local/lib/node_modules/flowise/node_modules/flowise-components/dist/nodes/agentflow/Start/Start.js","position":{"x":100,"y":100},"inputAnchors":[],"inputParams":[{"label":"Input Type","name":"startInputType","type":"options","options":[{"label":"Chat Input","name":"chatInput","description":"Start the conversation with chat input"},{"label":"Form Input","name":"formInput","description":"Start the workflow with form inputs"}],"default":"chatInput","id":"startAgentflow_0-input-startInputType-options","display":true},{"label":"Form Title","name":"formTitle","type":"string","placeholder":"Please Fill Out The Form","show":{"startInputType":"formInput"},"id":"startAgentflow_0-input-formTitle-string","display":false},{"label":"Form Description","name":"formDescription","type":"string","placeholder":"Complete all fields below to continue","show":{"startInputType":"formInput"},"id":"startAgentflow_0-input-formDescription-string","display":false},{"label":"Form Input Types","name":"formInputTypes","description":"Specify the type of form input","type":"array","show":{"startInputType":"formInput"},"array":[{"label":"Type","name":"type","type":"options","options":[{"label":"String","name":"string"},{"label":"Number","name":"number"},{"label":"Boolean","name":"boolean"},{"label":"Options","name":"options"}],"default":"string"},{"label":"Label","name":"label","type":"string","placeholder":"Label for the input"},{"label":"Variable Name","name":"name","type":"string","placeholder":"Variable name for the input (must be camel case)","description":"Variable name must be camel case. For example: firstName, lastName, etc."},{"label":"Add Options","name":"addOptions","type":"array","show":{"formInputTypes[$index].type":"options"},"array":[{"label":"Option","name":"option","type":"string"}]}],"id":"startAgentflow_0-input-formInputTypes-array","display":false},{"label":"Ephemeral Memory","name":"startEphemeralMemory","type":"boolean","description":"Start fresh for every execution without past chat history","optional":true,"id":"startAgentflow_0-input-startEphemeralMemory-boolean","display":true},{"label":"Flow State","name":"startState","description":"Runtime state during the execution of the workflow","type":"array","optional":true,"array":[{"label":"Key","name":"key","type":"string","placeholder":"Foo"},{"label":"Value","name":"value","type":"string","placeholder":"Bar","optional":true}],"id":"startAgentflow_0-input-startState-array","display":true},{"label":"Persist State","name":"startPersistState","type":"boolean","description":"Persist the state in the same session","optional":true,"id":"startAgentflow_0-input-startPersistState-boolean","display":true}],"outputs":{},"outputAnchors":[{"id":"startAgentflow_0-output-startAgentflow","label":"Start","name":"startAgentflow"}],"id":"startAgentflow_0","selected":false},"width":103,"height":66,"selected":false,"positionAbsolute":{"x":-27,"y":99},"dragging":false},{"id":"agentAgentflow_0","position":{"x":182.5,"y":96},"data":{"loadMethods":{},"label":"Exploratory Tester Agent","name":"agentAgentflow","version":2,"type":"Agent","category":"Agent Flows","description":"Dynamically choose and utilize tools during runtime, enabling multi-step reasoning","color":"#4DD0E1","baseClasses":["Agent"],"inputs":{"agentModel":"chatOpenAI","agentMessages":[{"role":"system","content":"<p>As an Exploratory Master Quality Tester, your primary responsibility is to thoroughly explore target applications and gain a deep understanding of their functionalities. You will navigate through various screens and explore different sites to identify any issues. </p><p>Key Responsibilities: </p><p>Issue Reporting: If you encounter any issues during your testing, please report them immediately. Include detailed, reproducible steps to help us understand the problem. </p><p>Testing Schedule: Clearly communicate when you will be conducting your tests to ensure proper coordination. Use of Realistic Data: Always utilize realistic data that aligns with the application's context to enhance the validity of your testing. </p><p>Flow Management: Keep track of your testing flows to avoid repetition. Aim to explore new paths and functionalities rather than revisiting the same flows repeatedly. </p><p>Utilization of Tools: Leverage the necessary tools from Playwright to facilitate your exploratory testing.</p>"}],"agentToolsBuiltInOpenAI":"","agentTools":[{"agentSelectedTool":"customMCP","agentSelectedToolRequiresHumanInput":false,"agentSelectedToolConfig":{"mcpServerConfig":"{\n \"url\": \"http://host.docker.internal:8931/mcp\"\n}","mcpActions":"[\"browser_click\",\"browser_close\",\"browser_console_messages\",\"browser_drag\",\"browser_evaluate\",\"browser_file_upload\",\"browser_fill_form\",\"browser_handle_dialog\",\"browser_hover\",\"browser_navigate\",\"browser_navigate_back\",\"browser_network_requests\",\"browser_press_key\",\"browser_resize\",\"browser_select_option\",\"browser_snapshot\",\"browser_tabs\",\"browser_take_screenshot\",\"browser_type\",\"browser_wait_for\",\"browser_install\"]","agentSelectedTool":"customMCP"}}],"agentKnowledgeDocumentStores":"","agentKnowledgeVSEmbeddings":"","agentEnableMemory":true,"agentMemoryType":"windowSize","agentUserMessage":"","agentReturnResponseAs":"userMessage","agentUpdateState":[],"agentModelConfig":{"cache":"","modelName":"gpt-4.1-mini","temperature":"0.6","streaming":true,"maxTokens":"","topP":"","frequencyPenalty":"","presencePenalty":"","timeout":"","strictToolCalling":false,"stopSequence":"","basepath":"","proxyUrl":"","baseOptions":"","allowImageUploads":"","reasoning":"","agentModel":"chatOpenAI","FLOWISE_CREDENTIAL_ID":"93dcf2ca-fc7e-45b3-9845-3c649762714d"},"agentMemoryWindowSize":"5"},"filePath":"/usr/local/lib/node_modules/flowise/node_modules/flowise-components/dist/nodes/agentflow/Agent/Agent.js","inputAnchors":[],"inputParams":[{"label":"Model","name":"agentModel","type":"asyncOptions","loadMethod":"listModels","loadConfig":true,"id":"agentAgentflow_0-input-agentModel-asyncOptions","display":true},{"label":"Messages","name":"agentMessages","type":"array","optional":true,"acceptVariable":true,"array":[{"label":"Role","name":"role","type":"options","options":[{"label":"System","name":"system"},{"label":"Assistant","name":"assistant"},{"label":"Developer","name":"developer"},{"label":"User","name":"user"}]},{"label":"Content","name":"content","type":"string","acceptVariable":true,"generateInstruction":true,"rows":4}],"id":"agentAgentflow_0-input-agentMessages-array","display":true},{"label":"OpenAI Built-in Tools","name":"agentToolsBuiltInOpenAI","type":"multiOptions","optional":true,"options":[{"label":"Web Search","name":"web_search_preview","description":"Search the web for the latest information"},{"label":"Code Interpreter","name":"code_interpreter","description":"Write and run Python code in a sandboxed environment"},{"label":"Image Generation","name":"image_generation","description":"Generate images based on a text prompt"}],"show":{"agentModel":"chatOpenAI"},"id":"agentAgentflow_0-input-agentToolsBuiltInOpenAI-multiOptions","display":true},{"label":"Tools","name":"agentTools","type":"array","optional":true,"array":[{"label":"Tool","name":"agentSelectedTool","type":"asyncOptions","loadMethod":"listTools","loadConfig":true},{"label":"Require Human Input","name":"agentSelectedToolRequiresHumanInput","type":"boolean","optional":true}],"id":"agentAgentflow_0-input-agentTools-array","display":true},{"label":"Knowledge (Document Stores)","name":"agentKnowledgeDocumentStores","type":"array","description":"Give your agent context about different document sources. Document stores must be upserted in advance.","array":[{"label":"Document Store","name":"documentStore","type":"asyncOptions","loadMethod":"listStores"},{"label":"Describe Knowledge","name":"docStoreDescription","type":"string","generateDocStoreDescription":true,"placeholder":"Describe what the knowledge base is about, this is useful for the AI to know when and how to search for correct information","rows":4},{"label":"Return Source Documents","name":"returnSourceDocuments","type":"boolean","optional":true}],"optional":true,"id":"agentAgentflow_0-input-agentKnowledgeDocumentStores-array","display":true},{"label":"Knowledge (Vector Embeddings)","name":"agentKnowledgeVSEmbeddings","type":"array","description":"Give your agent context about different document sources from existing vector stores and embeddings","array":[{"label":"Vector Store","name":"vectorStore","type":"asyncOptions","loadMethod":"listVectorStores","loadConfig":true},{"label":"Embedding Model","name":"embeddingModel","type":"asyncOptions","loadMethod":"listEmbeddings","loadConfig":true},{"label":"Knowledge Name","name":"knowledgeName","type":"string","placeholder":"A short name for the knowledge base, this is useful for the AI to know when and how to search for correct information"},{"label":"Describe Knowledge","name":"knowledgeDescription","type":"string","placeholder":"Describe what the knowledge base is about, this is useful for the AI to know when and how to search for correct information","rows":4},{"label":"Return Source Documents","name":"returnSourceDocuments","type":"boolean","optional":true}],"optional":true,"id":"agentAgentflow_0-input-agentKnowledgeVSEmbeddings-array","display":true},{"label":"Enable Memory","name":"agentEnableMemory","type":"boolean","description":"Enable memory for the conversation thread","default":true,"optional":true,"id":"agentAgentflow_0-input-agentEnableMemory-boolean","display":true},{"label":"Memory Type","name":"agentMemoryType","type":"options","options":[{"label":"All Messages","name":"allMessages","description":"Retrieve all messages from the conversation"},{"label":"Window Size","name":"windowSize","description":"Uses a fixed window size to surface the last N messages"},{"label":"Conversation Summary","name":"conversationSummary","description":"Summarizes the whole conversation"},{"label":"Conversation Summary Buffer","name":"conversationSummaryBuffer","description":"Summarize conversations once token limit is reached. Default to 2000"}],"optional":true,"default":"allMessages","show":{"agentEnableMemory":true},"id":"agentAgentflow_0-input-agentMemoryType-options","display":true},{"label":"Window Size","name":"agentMemoryWindowSize","type":"number","default":"20","description":"Uses a fixed window size to surface the last N messages","show":{"agentMemoryType":"windowSize"},"id":"agentAgentflow_0-input-agentMemoryWindowSize-number","display":true},{"label":"Max Token Limit","name":"agentMemoryMaxTokenLimit","type":"number","default":"2000","description":"Summarize conversations once token limit is reached. Default to 2000","show":{"agentMemoryType":"conversationSummaryBuffer"},"id":"agentAgentflow_0-input-agentMemoryMaxTokenLimit-number","display":false},{"label":"Input Message","name":"agentUserMessage","type":"string","description":"Add an input message as user message at the end of the conversation","rows":4,"optional":true,"acceptVariable":true,"show":{"agentEnableMemory":true},"id":"agentAgentflow_0-input-agentUserMessage-string","display":true},{"label":"Return Response As","name":"agentReturnResponseAs","type":"options","options":[{"label":"User Message","name":"userMessage"},{"label":"Assistant Message","name":"assistantMessage"}],"default":"userMessage","id":"agentAgentflow_0-input-agentReturnResponseAs-options","display":true},{"label":"Update Flow State","name":"agentUpdateState","description":"Update runtime state during the execution of the workflow","type":"array","optional":true,"acceptVariable":true,"array":[{"label":"Key","name":"key","type":"asyncOptions","loadMethod":"listRuntimeStateKeys","freeSolo":true},{"label":"Value","name":"value","type":"string","acceptVariable":true,"acceptNodeOutputAsVariable":true}],"id":"agentAgentflow_0-input-agentUpdateState-array","display":true}],"outputs":{},"outputAnchors":[{"id":"agentAgentflow_0-output-agentAgentflow","label":"Agent","name":"agentAgentflow"}],"id":"agentAgentflow_0","selected":false},"type":"agentFlow","width":234,"height":100,"selected":true,"dragging":false,"positionAbsolute":{"x":182.5,"y":96}}],"edges":[{"source":"startAgentflow_0","sourceHandle":"startAgentflow_0-output-startAgentflow","target":"agentAgentflow_0","targetHandle":"agentAgentflow_0","data":{"sourceColor":"#7EE787","targetColor":"#4DD0E1","isHumanInput":false},"type":"agentFlow","id":"startAgentflow_0-startAgentflow_0-output-startAgentflow-agentAgentflow_0-agentAgentflow_0"}],"viewport":{"x":330.5,"y":36,"zoom":2}}

Use Method

Docker

Flowise Version

flowise/3.0.5 linux-arm64 node-v20.19.4

Operating System

macOS

Browser

Chrome

Additional context

Error Logs:
Playwright MCP SSE logs showing context closure:

pw:mcp:test close browser context (persistent) +8s
pw:mcp:test release user data dir /Users/{user}/Library/Caches/ms-playwright/mcp-chrome +0ms
pw:mcp:test close browser context complete (persistent) +70ms
pw:mcp:test create http session: e65a6e4f-dfdf-4fd5-b899-6c138a89eba0 +1s
pw:mcp:test create context +1s
pw:mcp:test delete http session: a767b30d-c944-425a-9a64-8c8ccfe9f7ca +2s
pw:mcp:test delete http session: e65a6e4f-dfdf-4fd5-b899-6c138a89eba0 +3s
pw:mcp:test create http session: 11075e0e-4811-4b6e-9b28-3af924e1f07a +8s
pw:mcp:test create context +13s
pw:mcp:test create browser context (persistent) +14s
pw:mcp:test lock user data dir /Users/{user}/Library/Caches/ms-playwright/mcp-chrome +0ms
pw:mcp:test delete http session: 11075e0e-4811-4b6e-9b28-3af924e1f07a +8s
pw:mcp:test close context +8s
pw:mcp:test close browser context (persistent) +8s
pw:mcp:test release user data dir /Users/{user}/Library/Caches/ms-playwright/mcp-chrome +0ms
pw:mcp:test close browser context complete (persistent) +64ms

Tool execution error:

{  
  "tool": "browser_press_key",  
  "toolInput": {"key": "Enter"},  
  "toolOutput": "[{\"type\":\"text\",\"text\":\"### Result\\nError: No open pages available. Use the \\\"browser_navigate\\\" tool to navigate to a page first.\\n\"}]"  
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions