execute_code
Execute TypeScript code to orchestrate multi-tool workflows through secure sandboxed execution, accessing MCP tool APIs for browser automation and documentation retrieval.
Instructions
Execute TypeScript code with access to MCP tool APIs.
Available APIs:
context7:
__mcp_call('context7__resolve-library-id', {libraryName: value})[context7] Resolves a package/product name to a Context7-compatible library ID and returns a list of matching libraries.
You MUST call this function before 'get-library-docs' to obtain a valid Context7-compatible library ID UNLESS the user explicitly provides a library ID in the format '/org/project' or '/org/project/version' in their query.
Selection Process:
Analyze the query to understand what library/package the user is looking for
Return the most relevant match based on:
Name similarity to the query (exact matches prioritized)
Description relevance to the query's intent
Documentation coverage (prioritize libraries with higher Code Snippet counts)
Source reputation (consider libraries with High or Medium reputation more authoritative)
Benchmark Score: Quality indicator (100 is the highest score)
Response Format:
Return the selected library ID in a clearly marked section
Provide a brief explanation for why this library was chosen
If multiple good matches exist, acknowledge this but proceed with the most relevant one
If no good matches exist, clearly state this and suggest query refinements
For ambiguous queries, request clarification before proceeding with a best-guess match. Parameters: libraryName: string
__mcp_call('context7__get-library-docs', {context7CompatibleLibraryID: value, topic?: value, page?: value})[context7] Fetches up-to-date documentation for a library. You must call 'resolve-library-id' first to obtain the exact Context7-compatible library ID required to use this tool, UNLESS the user explicitly provides a library ID in the format '/org/project' or '/org/project/version' in their query. Parameters: context7CompatibleLibraryID: string, topic?: string, page?: integer
playwright:
__mcp_call('playwright__browser_close', {})[playwright] Close the page__mcp_call('playwright__browser_resize', {width: value, height: value})[playwright] Resize the browser window Parameters: width: number, height: number__mcp_call('playwright__browser_console_messages', {onlyErrors?: value})[playwright] Returns all console messages Parameters: onlyErrors?: boolean__mcp_call('playwright__browser_handle_dialog', {accept: value, promptText?: value})[playwright] Handle a dialog Parameters: accept: boolean, promptText?: string__mcp_call('playwright__browser_evaluate', {function: value, element?: value, ref?: value})[playwright] Evaluate JavaScript expression on page or element Parameters: function: string, element?: string, ref?: string__mcp_call('playwright__browser_file_upload', {paths?: value})[playwright] Upload one or multiple files Parameters: paths?: array__mcp_call('playwright__browser_fill_form', {fields: value})[playwright] Fill multiple form fields Parameters: fields: array__mcp_call('playwright__browser_install', {})[playwright] Install the browser specified in the config. Call this if you get an error about the browser not being installed.__mcp_call('playwright__browser_press_key', {key: value})[playwright] Press a key on the keyboard Parameters: key: string__mcp_call('playwright__browser_type', {element: value, ref: value, text: value, submit?: value, slowly?: value})[playwright] Type text into editable element Parameters: element: string, ref: string, text: string, submit?: boolean, slowly?: boolean__mcp_call('playwright__browser_navigate', {url: value})[playwright] Navigate to a URL Parameters: url: string__mcp_call('playwright__browser_navigate_back', {})[playwright] Go back to the previous page__mcp_call('playwright__browser_network_requests', {})[playwright] Returns all network requests since loading the page__mcp_call('playwright__browser_run_code', {code: value})[playwright] Run Playwright code snippet Parameters: code: string__mcp_call('playwright__browser_take_screenshot', {type?: value, filename?: value, element?: value, ref?: value, fullPage?: value})[playwright] Take a screenshot of the current page. You can't perform actions based on the screenshot, use browser_snapshot for actions. Parameters: type?: string, filename?: string, element?: string, ref?: string, fullPage?: boolean__mcp_call('playwright__browser_snapshot', {})[playwright] Capture accessibility snapshot of the current page, this is better than screenshot__mcp_call('playwright__browser_click', {element: value, ref: value, doubleClick?: value, button?: value, modifiers?: value})[playwright] Perform click on a web page Parameters: element: string, ref: string, doubleClick?: boolean, button?: string, modifiers?: array__mcp_call('playwright__browser_drag', {startElement: value, startRef: value, endElement: value, endRef: value})[playwright] Perform drag and drop between two elements Parameters: startElement: string, startRef: string, endElement: string, endRef: string__mcp_call('playwright__browser_hover', {element: value, ref: value})[playwright] Hover over element on page Parameters: element: string, ref: string__mcp_call('playwright__browser_select_option', {element: value, ref: value, values: value})[playwright] Select an option in a dropdown Parameters: element: string, ref: string, values: array__mcp_call('playwright__browser_tabs', {action: value, index?: value})[playwright] List, create, close, or select a browser tab. Parameters: action: string, index?: number__mcp_call('playwright__browser_wait_for', {time?: value, text?: value, textGone?: value})[playwright] Wait for text to appear or disappear or a specified time to pass Parameters: time?: number, text?: string, textGone?: string
chrome-devtools:
__mcp_call('chrome-devtools__click', {uid: value, dblClick?: value})[chrome-devtools] Clicks on the provided element Parameters: uid: string, dblClick?: boolean__mcp_call('chrome-devtools__close_page', {pageIdx: value})[chrome-devtools] Closes the page by its index. The last open page cannot be closed. Parameters: pageIdx: number__mcp_call('chrome-devtools__drag', {from_uid: value, to_uid: value})[chrome-devtools] Drag an element onto another element Parameters: from_uid: string, to_uid: string__mcp_call('chrome-devtools__emulate', {networkConditions?: value, cpuThrottlingRate?: value})[chrome-devtools] Emulates various features on the selected page. Parameters: networkConditions?: string, cpuThrottlingRate?: number__mcp_call('chrome-devtools__evaluate_script', {function: value, args?: value})[chrome-devtools] Evaluate a JavaScript function inside the currently selected page. Returns the response as JSON so returned values have to JSON-serializable. Parameters: function: string, args?: array__mcp_call('chrome-devtools__fill', {uid: value, value: value})[chrome-devtools] Type text into a input, text area or select an option from a element. Parameters: uid: string, value: string__mcp_call('chrome-devtools__fill_form', {elements: value})[chrome-devtools] Fill out multiple form elements at once Parameters: elements: array__mcp_call('chrome-devtools__get_console_message', {msgid: value})[chrome-devtools] Gets a console message by its ID. You can get all messages by calling list_console_messages. Parameters: msgid: number__mcp_call('chrome-devtools__get_network_request', {reqid?: value})[chrome-devtools] Gets a network request by an optional reqid, if omitted returns the currently selected request in the DevTools Network panel. Parameters: reqid?: number__mcp_call('chrome-devtools__handle_dialog', {action: value, promptText?: value})[chrome-devtools] If a browser dialog was opened, use this command to handle it Parameters: action: string, promptText?: string__mcp_call('chrome-devtools__hover', {uid: value})[chrome-devtools] Hover over the provided element Parameters: uid: string__mcp_call('chrome-devtools__list_console_messages', {pageSize?: value, pageIdx?: value, types?: value, includePreservedMessages?: value})[chrome-devtools] List all console messages for the currently selected page since the last navigation. Parameters: pageSize?: integer, pageIdx?: integer, types?: array, includePreservedMessages?: boolean__mcp_call('chrome-devtools__list_network_requests', {pageSize?: value, pageIdx?: value, resourceTypes?: value, includePreservedRequests?: value})[chrome-devtools] List all requests for the currently selected page since the last navigation. Parameters: pageSize?: integer, pageIdx?: integer, resourceTypes?: array, includePreservedRequests?: boolean__mcp_call('chrome-devtools__list_pages', {})[chrome-devtools] Get a list of pages open in the browser.__mcp_call('chrome-devtools__navigate_page', {type?: value, url?: value, ignoreCache?: value, timeout?: value})[chrome-devtools] Navigates the currently selected page to a URL. Parameters: type?: string, url?: string, ignoreCache?: boolean, timeout?: integer__mcp_call('chrome-devtools__new_page', {url: value, timeout?: value})[chrome-devtools] Creates a new page Parameters: url: string, timeout?: integer__mcp_call('chrome-devtools__performance_analyze_insight', {insightSetId: value, insightName: value})[chrome-devtools] Provides more detailed information on a specific Performance Insight of an insight set that was highlighted in the results of a trace recording. Parameters: insightSetId: string, insightName: string__mcp_call('chrome-devtools__performance_start_trace', {reload: value, autoStop: value})[chrome-devtools] Starts a performance trace recording on the selected page. This can be used to look for performance problems and insights to improve the performance of the page. It will also report Core Web Vital (CWV) scores for the page. Parameters: reload: boolean, autoStop: boolean__mcp_call('chrome-devtools__performance_stop_trace', {})[chrome-devtools] Stops the active performance trace recording on the selected page.__mcp_call('chrome-devtools__press_key', {key: value})[chrome-devtools] Press a key or key combination. Use this when other input methods like fill() cannot be used (e.g., keyboard shortcuts, navigation keys, or special key combinations). Parameters: key: string__mcp_call('chrome-devtools__resize_page', {width: value, height: value})[chrome-devtools] Resizes the selected page's window so that the page has specified dimension Parameters: width: number, height: number__mcp_call('chrome-devtools__select_page', {pageIdx: value})[chrome-devtools] Select a page as a context for future tool calls. Parameters: pageIdx: number__mcp_call('chrome-devtools__take_screenshot', {format?: value, quality?: value, uid?: value, fullPage?: value, filePath?: value})[chrome-devtools] Take a screenshot of the page or element. Parameters: format?: string, quality?: number, uid?: string, fullPage?: boolean, filePath?: string__mcp_call('chrome-devtools__take_snapshot', {verbose?: value, filePath?: value})[chrome-devtools] Take a text snapshot of the currently selected page based on the a11y tree. The snapshot lists page elements along with a unique identifier (uid). Always use the latest snapshot. Prefer taking a snapshot over taking a screenshot. The snapshot indicates the element selected in the DevTools Elements panel (if any). Parameters: verbose?: boolean, filePath?: string__mcp_call('chrome-devtools__upload_file', {uid: value, filePath: value})[chrome-devtools] Upload a file through a provided element. Parameters: uid: string, filePath: string__mcp_call('chrome-devtools__wait_for', {text: value, timeout?: value})[chrome-devtools] Wait for the specified text to appear on the selected page. Parameters: text: string, timeout?: integer
The code will run in a secure sandbox with:
No network access
No filesystem access
Access only to MCP tool APIs
console.log() output will be returned to you
Example Usage:
Multi-step workflow example:
Note: Intermediate data stays in the sandbox (doesn't enter your context), saving massive amounts of tokens for complex workflows.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | TypeScript code to execute in the sandbox | |
| timeout | No | Timeout in milliseconds (default: 30000) |