Skip to main content
Glama

Replace a script

replace_script
Destructive

Replace every block of a project's script. Whole-script replace: blocks you leave out are deleted, and block ids change. The project must be inactive. To change one block on a live script, use update_block. Read the subo://guide/authoring resource before writing blocks: block type names, section names and the piping rules are not guessable. Its §0 routes on the kind of project (prediction, quiz, form...) to the module to read first, such as subo://guide/kinds/prediction.

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": {
      "project_id": "<project_id>",
      "blocks": "<blocks>"
    },
    "name": "replace_script"
  }
}

Input Schema

NameRequiredDescriptionDefault
blocksYes
project_idYesProject id, from list_projects or create_project.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • addedInput schema / $defs / BlockSchema / properties / upload
      Added value: +{
      +  "anyOf": [
      +    {
      +      "$ref": "#/$defs/UploadSchema"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null
      +}
    • addedInput schema / $defs / UploadSchema
      Added value: +{
      +  "description": "A `file_upload` block's rules. Every field is optional: images and documents,\none file, required, up to the community's plan limit.",
      +  "properties": {
      +    "categories": {
      +      "anyOf": [
      +        {
      +          "items": {
      +            "type": "string"
      +          },
      +          "type": "array"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ],
      +      "default": null,
      +      "title": "Categories"
      +    },
      +    "max_bytes": {
      +      "anyOf": [
      +        {
      +          "type": "integer"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ],
      +      "default": null,
      +      "title": "Max Bytes"
      +    },
      +    "max_files": {
      +      "anyOf": [
      +        {
      +          "type": "integer"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ],
      +      "default": null,
      +      "title": "Max Files"
      +    },
      +    "min_files": {
      +      "anyOf": [
      +        {
      +          "type": "integer"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ],
      +      "default": null,
      +      "title": "Min Files"
      +    }
      +  },
      +  "title": "UploadSchema",
      +  "type": "object"
      +}
  2. Changed4 schema fields changed
    • changedInput schema / $defs / ActionConfigSchema / properties / fire_scope / anyOf
      Previous value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "enum": [
      +      "respondent",
      +      "session"
      +    ],
      +    "type": "string"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • changedInput schema / $defs / BlockOptionSchema / properties / anchor_position / anyOf
      Previous value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "const": "last",
      +    "type": "string"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • changedInput schema / $defs / ContinueSchema / properties / after / anyOf
      Previous value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "enum": [
      +      "pause",
      +      "click"
      +    ],
      +    "type": "string"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • changedInput schema / $defs / ContinueSchema / properties / pause / anyOf
      Previous value: -[
      -  {
      -    "type": "integer"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "minimum": 0,
      +    "type": "integer"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
  3. Changed1 schema field changed
    • addedInput schema / $defs / BlockSchema / properties / text_analysis
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "boolean"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "title": "Text Analysis"
      +}
  4. First observed

TDQS

A4.5/5.0
Behavior3/5

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

Annotations already declare destructiveHint=true, readOnlyHint=false and idempotentHint=false, so the write/destructive profile is carried by structured data. The description nonetheless adds genuinely non-obvious behavior: omitted blocks are deleted and block ids change, plus the inactive-project precondition. It stops short of noting irreversibility or whether a prior version can be recovered, which for an idempotent=false destructive replace would be the remaining high-value detail.

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 destructive semantics, then precondition, then the alternative, then the reference docs, in descending order of decision value. Every sentence carries a distinct decision the caller must make; there is no restatement of the title or name.

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?

Covers the elements that matter for a destructive two-parameter replace: what is destroyed, id churn, state precondition, the correct alternative for live scripts, and where the unguessable payload vocabulary lives. No output schema exists, but the id-change note tells the agent what to expect from the result, so the definition is complete for its complexity.

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

Parameters4/5

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

Only project_id carries a schema description, and blocks is a large nested schema whose most error-prone fields (type, section, piping) are undocumented in-schema. The description compensates by declaring those names "not guessable" and routing the agent to subo://guide/authoring and §0 project-kind modules, which is real semantic aid beyond the schema. It does not explain individual block fields, so it complements rather than replaces the schema.

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 ("Replace every block of a project's script") and immediately disambiguates with "Whole-script replace" plus the sibling it is not ("To change one block on a live script, use update_block"). An agent can distinguish it from update_block and generate_script without opening any 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?

Gives the selection rule explicitly (whole script here, single block on a live script via update_block), states a hard precondition ("The project must be inactive"), and names a mandatory prerequisite reading order including where to start in the authoring guide. Nothing about when to use or when not to use is left to inference.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.