[GH-ISSUE #1013] [langchain Agent]: Invalid schema error while tool calling from Playwright MCP #133

Open
opened 2026-02-17 17:19:15 -05:00 by yindo · 1 comment
Owner

Originally created by @dkundu56 on GitHub (Oct 20, 2025).
Original GitHub issue: https://github.com/langchain-ai/docs/issues/1013

Type of issue

issue / bug

Language

Python

Description

from langchain.agents import create_agent

playwright_mcp_client_isolated = MultiServerMCPClient(
        {
            "playwright": {
                "transport": "stdio",
                "command": "npx",
                "args": [
                    "@playwright/mcp@latest",
                    "--browser=chrome",
                    "--isolated",
                    f"--output-dir={playwright_reports_dir}",
                    f"--secrets={secrets_file_path}",
                    "--caps=testing"
                ]
            }
        })

tools = await playwright_mcp_client_isolated.get_tools()

agent = create_agent(
            model="openai:gpt-4.1",
            tools=tools,
            system_prompt=agent_instructions,
            response_format=ExplorerAgentOutput,
        )

agent_response = await agent.ainvoke({"messages": user_prompt},
                                             {"recursion_limit": 100})
        structured_output = agent_response["structured_response"]
        final_output_json = structured_output.model_dump()
        print(f"FINAL REPORT: \n{final_output_json}")

output:

openai.BadRequestError: Error code: 400 - {'error': {'message': "Invalid schema for function 'browser_console_messages': In context=(), 'required' is required to be supplied and to be an array including every key in properties. Missing 'onlyErrors'.", 'type': 'invalid_request_error', 'param': 'tools[2].function.parameters', 'code': 'invalid_function_parameters'}}
During task with name 'model' and id '708d0a1a-0bb5-1d86-e7d7-b37d6e41009a'

but the similar one is working perfectly fine with create_react_agent from langGraph.prebuilt and also in other frameworks like openai_sdk or mcp-use

Originally created by @dkundu56 on GitHub (Oct 20, 2025). Original GitHub issue: https://github.com/langchain-ai/docs/issues/1013 ### Type of issue issue / bug ### Language Python ### Description ``` from langchain.agents import create_agent playwright_mcp_client_isolated = MultiServerMCPClient( { "playwright": { "transport": "stdio", "command": "npx", "args": [ "@playwright/mcp@latest", "--browser=chrome", "--isolated", f"--output-dir={playwright_reports_dir}", f"--secrets={secrets_file_path}", "--caps=testing" ] } }) tools = await playwright_mcp_client_isolated.get_tools() agent = create_agent( model="openai:gpt-4.1", tools=tools, system_prompt=agent_instructions, response_format=ExplorerAgentOutput, ) agent_response = await agent.ainvoke({"messages": user_prompt}, {"recursion_limit": 100}) structured_output = agent_response["structured_response"] final_output_json = structured_output.model_dump() print(f"FINAL REPORT: \n{final_output_json}") ``` output: ``` openai.BadRequestError: Error code: 400 - {'error': {'message': "Invalid schema for function 'browser_console_messages': In context=(), 'required' is required to be supplied and to be an array including every key in properties. Missing 'onlyErrors'.", 'type': 'invalid_request_error', 'param': 'tools[2].function.parameters', 'code': 'invalid_function_parameters'}} During task with name 'model' and id '708d0a1a-0bb5-1d86-e7d7-b37d6e41009a' ``` but the similar one is working perfectly fine with create_react_agent from langGraph.prebuilt and also in other frameworks like openai_sdk or mcp-use
yindo added the langchainexternal labels 2026-02-17 17:19:15 -05:00
Author
Owner

@dkundu56 commented on GitHub (Oct 29, 2025):

Can someone please look into this issue. Its acts a blocker for our project

@dkundu56 commented on GitHub (Oct 29, 2025): Can someone please look into this issue. Its acts a blocker for our project
yindo changed title from [langchain Agent]: Invalid schema error while tool calling from Playwright MCP to [GH-ISSUE #1013] [langchain Agent]: Invalid schema error while tool calling from Playwright MCP 2026-06-05 17:25:15 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/docs#133