Skip to main content
Glama

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

TableJSON Schema
NameRequiredDescriptionDefault
codeNoJavaScript code to execute. The 'DATA' global variable contains the raw data string. Use console.log() to output your extraction. Optional if using a template.
dataYesThe raw text or JSON output from another MCP tool to process.
languageNoLanguage of the code. Only 'javascript' is supported.javascript
templateNoName 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_toolNoOptional. Name of the MCP tool that produced the data (for logging/metrics only).
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description carries full burden. It details the secure sandbox, the DATA global variable, console.log output, and template usage. It does not explicitly state non-destructive behavior, but the processing nature is implied. Good but not exhaustive on side effects.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is relatively long but well-structured. It front-loads the main purpose, then explains usage, then introduces new features. Every sentence adds information, though minor redundancy could be trimmed.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no output schema and 5 parameters, the description covers the usage pattern, parameter roles, and template options. Missing explicit output format or error behavior, but overall sufficient for an agent to use the tool correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% but description adds value: explains how 'code' interacts with 'data' via the DATA global, introduces templates as an alternative to 'code', and clarifies the role of 'source_tool' for logging. This goes beyond the schema descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'A universal code-mode transformer' that takes raw text/JSON from any MCP tool and runs custom JavaScript or uses templates for extraction. It differentiates from sibling tools like brave_local_search_code_mode by being universal, explicitly listing many source tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicit guidance: 'Use this as a second step after calling any tool that returns large payloads'. Provides clear when-to-use context, mentions templates for common cases, and alternatives (custom code vs template).

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/dcostenco/prism-coder'

If you have feedback or need assistance with the MCP directory API, please join our Discord server