Skip to main content
Glama
N0moreher0
by N0moreher0

Execute JS

project_execute_js
Destructive

Execute JavaScript code snippets in a workspace to perform computations, file I/O, or prototyping, capturing stdout/stderr with timeout control.

Instructions

Evaluate JavaScript code. Runs node in the workspace, capturing stdout/stderr; supports top-level await and require. Use when: you need to run a small JS snippet for computation, file I/O via fs, or prototyping. Avoid when: you need a full shell pipeline (project_shell_run) or a persistent process. Speed: synchronous node exec with timeout (default 30s, cap 10min); output capped at 1 MiB. Output: execute_js: stdout_tail, stderr_tail, exit_code, timed_out, ok. Batch-safe: no

Input Schema

NameRequiredDescriptionDefault
argvNo
codeYes
timeout_msNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv1.5.4

TDQS

A4.4/5.0
Behavior4/5

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

Adds substantial context beyond the annotations: synchronous execution, 30s default / 10min cap timeout, 1 MiB output cap, and 'batch-safe: no'. It also discloses the return fields. What it under-sells is the destructive side that destructiveHint=true declares — 'file I/O via fs' hints at workspace mutation but never states that files can be created or overwritten, nor any sandboxing/permission limits (which matters given openWorldHint=false).

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

Conciseness5/5

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

Front-loaded with the core verb and mechanism, then cleanly labeled lines for use/avoid/speed/output/batching. No redundant sentences; every line adds a distinct fact.

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?

With no output schema, the description usefully enumerates the return fields (stdout_tail, stderr_tail, exit_code, timed_out, ok) and covers timing and size limits. The remaining gap is the undocumented `argv` parameter and the lack of any statement about workspace mutation risk.

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

Parameters3/5

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

Schema description coverage is 0%, so the description must carry all three params. It does well on timeout_ms (default 30s, cap 10min) and touches `code` (top-level await, require supported), but `argv` is never mentioned at all — an agent cannot tell what it feeds into the script. Partial compensation only.

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?

States a specific verb and resource ('Evaluate JavaScript code') and immediately grounds it in mechanism ('Runs `node` in the workspace, capturing stdout/stderr'). It explicitly contrasts itself with project_shell_run, so an agent can pick between them without opening either schema.

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?

Provides an explicit 'Use when' clause (small snippets, computation, fs I/O, prototyping) and an explicit 'Avoid when' clause naming the sibling (project_shell_run) and the persistent-process case. Both the positive and negative routing conditions are spelled out.

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