Skip to main content
Glama

Inject code into editor

set_code
Destructive

Writes code directly into browser-based code editors, bypassing paste blocking and verifying the inserted content by reading it back so the code is confirmed in place.

Instructions

Write code into the page's code editor, bypassing paste blocking. Tries the editor's own API first, then falls back to IME-style typing (insertText, never a paste event). The result is verified by reading the editor back, so 'verified: exact' means the code really is in the editor.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "code": "<code>"
    },
    "name": "set_code"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeYesThe complete source code to place in the editor
modeNoReplace the editor contents, or append to themreplace
modelIndexNoWhich editor if the page has several

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.8/5.0
Behavior4/5

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

Annotations already declare destructiveHint=true and openWorldHint=true, but the description adds genuinely non-obvious behavior: it avoids paste events via insertText, tries the editor's own API first, and reads the editor back for verification. It also defines the return signal ('verified: exact'), which matters since there is no output schema. It does not address failure modes (editor not found, zero editors on the page) or that replace mode discards existing contents.

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?

Three tight sentences: purpose and distinguishing trait first, mechanism second, verification semantics last. Every sentence carries information an agent cannot get from the schema or annotations, and nothing is padded.

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 destructive, open-world write tool with no output schema, the description covers the critical unknowns: how the write happens, that it dodges paste blocking, and how success is confirmed. Gaps remain around failure behavior and the loss of existing content in replace mode, but the essential call-time information is present.

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 100%, with code, mode (replace/append enum) and modelIndex all documented in the schema, so baseline 3 applies. The description adds nothing parameter-specific such as when append is preferable or what modelIndex means for multi-editor pages.

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

Purpose4/5

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

The description opens with a specific verb and resource plus a distinguishing trait: 'Write code into the page's code editor, bypassing paste blocking.' That clearly separates it from read-side siblings like get_code and inspect_editor, though no sibling is named explicitly, so an agent must infer the read/write split from the verb alone.

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

Usage Guidelines3/5

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

The 'bypassing paste blocking' phrasing implies when this tool is the right choice (paste-hostile editors), but there is no explicit when-not guidance or routing to inspect_editor/get_code when the agent first needs to know which editor exists or read current contents. The API-then-IME sequence describes internal fallback, not tool selection.

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