Skip to main content
Glama

Patch target JSON

patch_target

Apply an RFC 6902 JSON Patch to any sprite's raw JSON to edit blocks or fields not covered by higher-level tools. Reads the target JSON first, applies the patch atomically, and reports warnings for unknown opcodes.

Instructions

Apply an RFC 6902 JSON Patch to a target's raw JSON — the way to edit a sprite's scripts (blocks) or any field a higher-level tool does not cover, on a sprite you just made or an existing one. Paths are JSON Pointers into the object returned by get_target_json; read that first. To write blocks, discover opcodes with list_blocks and get the exact input/field shapes from get_block_schema — the result reports advisory warnings for unknown opcodes or inputs. The patch is applied atomically: if any operation fails the target is left unchanged. Notes: patching the costumes/sounds arrays does not touch stored asset bytes (use add_costume/remove_costume for those), and you are responsible for keeping blocks internally consistent (ids, next/parent links).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesSprite name, or "Stage".
patchYesA JSON Patch document (array of operations).
Behavior5/5

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

With no annotations provided, the description carries the full burden and does so thoroughly. It discloses atomicity (patch applied atomically, unchanged on failure), advisory warnings for unknown opcodes/inputs, that patching costumes/sounds doesn't touch asset bytes, and that the agent is responsible for block consistency (ids, next/parent links). These are non-obvious behavioral traits critical for correct use.

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 dense but every sentence earns its place. It front-loads the purpose in the first clause, then layers procedural steps and warnings without redundancy. The structure (main sentence, then 'Notes:') makes it easy to scan and retain.

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

Completeness5/5

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

Given the tool's complexity (RFC 6902 patching, modifying sprite scripts), the description is remarkably complete. It covers prerequisites (read get_target_json), how to build valid patches (list_blocks, get_block_schema), atomicity, warnings in the result, and scope limits (costumes/sounds). It also implicitly addresses the return via 'advisory warnings'. Nothing an agent needs to invoke it correctly is missing.

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?

Although the schema covers both parameters (name, patch) at 100%, the description adds significant value by explaining that paths are JSON Pointers into get_target_json output, how to discover block opcodes and shapes, and what the patch document represents. This goes well beyond the schema's basic type/description, guiding correct construction of the patch parameter.

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 action ('Apply an RFC 6902 JSON Patch to a target's raw JSON'), the resource (target's raw JSON), and the specific purpose (editing sprite scripts or fields not covered by higher-level tools). It explicitly distinguishes itself from siblings by mentioning 'any field a higher-level tool does not cover'.

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 gives explicit when-to-use guidance: it's for fields not covered by higher-level tools, and it directs the agent to read `get_target_json` first and use `list_blocks`/`get_block_schema` for block scripts. It also names alternatives for costumes/sounds (`add_costume`/`remove_costume`), making the decision tree clear.

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/AstroBlocksMod/ScratchMCP'

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