code_mode_transform
Extract specific fields from raw MCP tool output using custom JavaScript or pre-built templates. Pass data and code or template name for instant transformation.
Instructions
A universal code-mode transformer. Takes RAW TEXT or JSON output from ANY MCP tool (GitHub, Firecrawl, chrome-devtools, camoufox, codegraphcontext, videoMcp, arxiv, etc.) and runs a custom JavaScript code string against it in a secure QuickJS sandbox. Use this as a second step after calling any tool that returns large payloads — pass the raw output as 'data' and a JS extraction script as 'code'. Your script reads the 'DATA' global variable (a string of the tool output) and uses console.log() to print only the fields you need. NEW in v2.1: Pass 'template' instead of 'code' for instant extraction. Available templates: github_issues, github_prs, jira_tickets, dom_links, dom_headings, api_endpoints, slack_messages, csv_summary. Example: { data: '', template: 'github_issues' } — no custom code needed.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | No | JavaScript code to execute. The 'DATA' global variable contains the raw data string. Use console.log() to output your extraction. Optional if using a template. | |
| data | Yes | The raw text or JSON output from another MCP tool to process. | |
| language | No | Language of the code. Only 'javascript' is supported. | javascript |
| template | No | Name of a pre-built extraction template. Use instead of writing custom 'code'. Options: github_issues, github_prs, jira_tickets, dom_links, dom_headings, api_endpoints, slack_messages, csv_summary. | |
| source_tool | No | Optional. Name of the MCP tool that produced the data (for logging/metrics only). |