Skip to main content
Glama

executeScript

Execute custom JavaScript code within 3D scenes to create advanced effects, custom shaders, complex geometry, or procedural generation beyond standard tool capabilities.

Instructions

Execute arbitrary JavaScript code in the connected browser scene context. The code runs inside an async function with access to: scene (THREE.Scene), camera, renderer, controls, and a helpers object. Return a value to send it back. Use this for advanced effects the other tools cannot achieve — custom shaders, complex geometry, procedural generation, physics, etc.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesJavaScript code to execute. Has access to `scene`, `camera`, `renderer`, `controls`, and `THREE` (the Three.js namespace). Example: `const geo = new THREE.TorusKnotGeometry(1,0.3,128,16); const mat = new THREE.MeshStandardMaterial({color:"#ff0000"}); const m = new THREE.Mesh(geo,mat); scene.add(m); return "done";`
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes the execution environment ('runs inside an async function with access to: scene (THREE.Scene), camera, renderer, controls, and a helpers object'), the return mechanism ('Return a value to send it back'), and the general capability scope. It doesn't mention security implications, error handling, or performance limitations, but provides substantial operational context.

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?

The description is efficiently structured with three sentences: the core functionality, the execution context details, and the usage guidelines. Every sentence adds essential information with zero wasted words, making it easy to parse and understand.

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?

For a powerful tool with no annotations and no output schema, the description provides strong context about the execution environment, return mechanism, and appropriate use cases. It could be more complete by mentioning potential risks of arbitrary code execution or error behavior, but it covers the essential operational aspects well given the complexity.

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?

The input schema has 100% description coverage, thoroughly documenting the single 'code' parameter with examples and context. The description adds no additional parameter information beyond what's already in the schema, so the baseline score of 3 is appropriate when the schema does the heavy lifting.

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 specific action ('Execute arbitrary JavaScript code') and the resource ('in the connected browser scene context'), distinguishing it from all sibling tools which perform specific predefined operations rather than allowing arbitrary code execution.

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?

The description provides explicit guidance on when to use this tool ('Use this for advanced effects the other tools cannot achieve — custom shaders, complex geometry, procedural generation, physics, etc.') and implicitly suggests when not to use it (for effects achievable through other sibling tools).

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/m-ai-geXR/mcp-webgpu'

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