Skip to main content
Glama

Set Parameter

set_param
Idempotent

Use this when you need to edit a param() default value in a kernelCAD script. Returns the modified code as text plus diagnostics from re-evaluating the result. Caller persists the new code via standard file-write tools (this tool has no side effects). With preview: true it builds the edit in a scratch session instead and returns the diff_geometry summary plus the requirements-ledger and S1 binding diffs (which requirements flip, which margins shrink, which selectors moved or re-bound), without touching the active session, source, revision or caches. A preview whose revised build fails returns ok:false and no diff. Inspect after.requirementsOk to see whether the edit preserves declared intent; preview.ok only says the preview could be computed. FEATURE MODE: pass { feature, changes } instead of param_name/new_value to change a feature's own literal arguments in place, by feature id (inspect({ of: 'features' }) lists ids and parameter names), e.g. { feature: 'cylinder_1', changes: { r: 3.3 } }. The argument is found from the feature's call site and each rewrite is verified by re-capturing the script; the whole model is rebuilt before and after, and the result carries new_code, edits (argument source before/after, line), changedParams (every feature parameter that moved) and the same geometry / requirementsDiff / bindings diff as preview. Writes nothing. A value driven by param() is refused with a hint to use set_param on that param instead.

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_param"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeYesThe .kcad.ts source code.
changesNoFeature mode: the feature's parameters to set, by parameter name, in mm or deg (e.g. { r: 3.3 }).
featureNoFeature mode: id of the feature to edit in place (e.g. 'cylinder_1'). Use with `changes` instead of param_name/new_value.
previewNoS6 edit preview: evaluate the edit in a scratch session and return geometry + requirements-ledger + S1 binding diffs. Writes nothing. Default false (the normal source-edit result).
new_valueNoThe new default value. A number for a numeric param (e.g. 12.5), a string expression evaluated in the script (e.g. "width/2 + 3") or a choice/colour, or true/false for a boolean param.
param_nameNoThe string literal name of the param (first arg to param()).

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changed
    • addedInput schema / properties / changes
      Added value: +{
      +  "additionalProperties": {
      +    "type": "number"
      +  },
      +  "description": "Feature mode: the feature's parameters to set, by parameter name, in mm or deg (e.g. { r: 3.3 }).",
      +  "type": "object"
      +}
    • addedInput schema / properties / feature
      Added value: +{
      +  "description": "Feature mode: id of the feature to edit in place (e.g. 'cylinder_1'). Use with `changes` instead of param_name/new_value.",
      +  "type": "string"
      +}
    • changedInput schema / required
      Previous value: -[
      -  "code",
      -  "param_name",
      -  "new_value"
      -]New value: +[
      +  "code"
      +]
  2. Changed3 schema fields changed
    • changedInput schema / properties / new_value / description
      Previous value: -"The new default value. Either a number for a numeric param (e.g. 12.5), or a string expression evaluated in the script (e.g. \"width/2 + 3\")."New value: +"The new default value. A number for a numeric param (e.g. 12.5), a string expression evaluated in the script (e.g. \"width/2 + 3\") or a choice/colour, or true/false for a boolean param."
    • changedInput schema / properties / new_value / examples
      Previous value: -[
      -  12.5,
      -  "width/2 + 3"
      -]New value: +[
      +  12.5,
      +  "width/2 + 3",
      +  true
      +]
    • changedInput schema / properties / new_value / oneOf
      Previous value: -[
      -  {
      -    "type": "number"
      -  },
      -  {
      -    "type": "string"
      -  }
      -]New value: +[
      +  {
      +    "type": "number"
      +  },
      +  {
      +    "type": "string"
      +  },
      +  {
      +    "type": "boolean"
      +  }
      +]
  3. Changed1 schema field changed
    • addedInput schema / properties / preview
      Added value: +{
      +  "description": "S6 edit preview: evaluate the edit in a scratch session and return geometry + requirements-ledger + S1 binding diffs. Writes nothing. Default false (the normal source-edit result).",
      +  "type": "boolean"
      +}
  4. Changed2 schema fields changed
    • removedOutput schema / properties
      Removed value: -{
      -  "binding_name": {
      -    "description": "JS const name bound to the new construct (when one was created).",
      -    "type": "string"
      -  },
      -  "diagnostics": {
      -    "description": "Diagnostics from re-evaluating the modified source.",
      -    "items": {
      -      "additionalProperties": true,
      -      "type": "object"
      -    },
      -    "type": "array"
      -  },
      -  "error": {
      -    "description": "Failure message (present when ok is false).",
      -    "type": "string"
      -  },
      -  "new_code": {
      -    "description": "Modified .kcad.ts source (present on success). Caller persists it.",
      -    "type": "string"
      -  },
      -  "ok": {
      -    "description": "Whether the edit applied and re-evaluated cleanly.",
      -    "type": "boolean"
      -  }
      -}
    • removedOutput schema / required
      Removed value: -[
      -  "ok"
      -]
  5. Changed3 schema fields changed
    • changedInput schema / properties / new_value / description
      Previous value: -"The new default value — number for numeric params, string for expressions."New value: +"The new default value. Either a number for a numeric param (e.g. 12.5), or a string expression evaluated in the script (e.g. \"width/2 + 3\")."
    • addedInput schema / properties / new_value / examples
      Added value: +[
      +  12.5,
      +  "width/2 + 3"
      +]
    • addedInput schema / properties / new_value / oneOf
      Added value: +[
      +  {
      +    "type": "number"
      +  },
      +  {
      +    "type": "string"
      +  }
      +]
  6. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "additionalProperties": true,
      +  "properties": {
      +    "binding_name": {
      +      "description": "JS const name bound to the new construct (when one was created).",
      +      "type": "string"
      +    },
      +    "diagnostics": {
      +      "description": "Diagnostics from re-evaluating the modified source.",
      +      "items": {
      +        "additionalProperties": true,
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "error": {
      +      "description": "Failure message (present when ok is false).",
      +      "type": "string"
      +    },
      +    "new_code": {
      +      "description": "Modified .kcad.ts source (present on success). Caller persists it.",
      +      "type": "string"
      +    },
      +    "ok": {
      +      "description": "Whether the edit applied and re-evaluated cleanly.",
      +      "type": "boolean"
      +    }
      +  },
      +  "required": [
      +    "ok"
      +  ],
      +  "type": "object"
      +}
  7. Added

TDQS

A4/5.0
Behavior1/5

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

The description is otherwise very detailed, but it contradicts the readOnlyHint=false annotation by repeatedly stating that the tool has no side effects and writes nothing. Per the rule for annotation contradictions, this dimension is scored 1.

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

Conciseness4/5

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

The description is front-loaded with the core purpose and then covers preview, failure handling, requirements inspection, and feature mode. It is dense and slightly repetitive about having no side effects, but the length is mostly justified by the tool's multiple modes.

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?

For a six-parameter, multi-mode editing tool with an output schema, the description covers the important behavioral distinctions: preview vs normal edit, scratch-session isolation, failure handling, requirementsOk interpretation, feature-mode rebuilds, and the param()-driven refusal case.

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?

Schema description coverage is 100%, so the schema already defines all six parameters. The description adds meaningful usage semantics for preview, feature/changes mode, param_name/new_value mode, and the refusal behavior when a value is param()-driven.

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 states a specific verb and resource: editing a param() default value in a kernelCAD script. It also clearly describes feature mode as an alternative operation, distinguishing editing a param from editing a feature's literal arguments.

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?

It explicitly says when to use the tool, when to use preview, when to use feature mode instead of param_name/new_value, how to inspect feature ids, and that a param-driven value is refused with a hint to use set_param instead.

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.