Skip to content

Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.

fix: MCP Server extract_content always returning 'No content extracted'

quanglm8406528c0855
diff --git a/browser_use/mcp/server.py b/browser_use/mcp/server.py
index 4debd23aa..46649c94d 100644
--- a/browser_use/mcp/server.py
+++ b/browser_use/mcp/server.py
@@ -722,10 +722,15 @@ class BrowserUseServer:
ExtractAction = create_model(
'ExtractAction',
__base__=ActionModel,
- extract_structured_data=(dict[str, Any], {'query': query, 'extract_links': extract_links}),
+ extract_structured_data=dict[str, Any],
)
- action = ExtractAction()
+ # Use model_validate because Pyright do not understand the dynamic model
+ action = ExtractAction.model_validate(
+ {
+ 'extract_structured_data': {'query': query, 'extract_links': extract_links},
+ }
+ )
action_result = await self.tools.act(
action=action,
browser_session=self.browser_session,