Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docs/tool-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -352,12 +352,12 @@ so returned values have to be JSON-serializable.

- **function** (string) **(required)**: A JavaScript function declaration to be executed by the tool in the currently selected page.
Example without arguments: `() => {
return document.title
return document.title
}` or `async () => {
return await fetch("example.com")
return await fetch("example.com")
}`.
Example with arguments: `(el) => {
return el.innerText;
return el.innerText;
Comment thread
zyzyzyryxy marked this conversation as resolved.
Resolved
}`

- **args** (array) _(optional)_: An optional list of arguments to pass to the function.
Expand Down Expand Up @@ -628,7 +628,7 @@ in the DevTools Elements panel (if any).
Third-party developer tools can be called via the '[`execute_3p_developer_tool`](#execute_3p_developer_tool)()' MCP tool.
Alternatively, third-party developer tools can be executed by calling '[`evaluate_script`](#evaluate_script)' and adding the
following command to the script:
'window.\_\_dtmcp.executeTool(toolName, params)'
'window.__dtmcp.executeTool(toolName, params)'
Comment thread
zyzyzyryxy marked this conversation as resolved.
Resolved
This might be helpful when the third-party developer tools return non-serializable values or when composing
third-party developer tools with additional functionality. (requires flag: --categoryExperimentalThirdParty=true)

Expand Down
150 changes: 75 additions & 75 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions src/tools/ToolDefinition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,7 @@ export function defineTool<
Args extends ParsedArguments = ParsedArguments,
>(
definition:
| ToolDefinition<Schema>
| ((args?: Args) => ToolDefinition<Schema>),
ToolDefinition<Schema> | ((args?: Args) => ToolDefinition<Schema>),
) {
if (typeof definition === 'function') {
const factory = definition;
Expand Down Expand Up @@ -364,8 +363,7 @@ export function definePageTool<
Args extends ParsedArguments = ParsedArguments,
>(
definition:
| PageToolDefinition<Schema>
| ((args?: Args) => PageToolDefinition<Schema>),
PageToolDefinition<Schema> | ((args?: Args) => PageToolDefinition<Schema>),
): DefinedPageTool<Schema> | ((args?: Args) => DefinedPageTool<Schema>) {
if (typeof definition === 'function') {
return (args?: Args): DefinedPageTool<Schema> => {
Expand Down
Loading