Skip to main content
Glama

Set a workspace variable

cm_set_workspace_var
Destructive

Set a MATLAB base or Simulink model workspace variable or field, logging the old value so cm_revert_all can restore it. Model changes stay in memory until cm_model_save and require an idle simulation.

Instructions

Set a variable or field. The old value is logged and cm_revert_all restores it. Model-workspace changes live in memory until cm_model_save. Requires an idle simulation.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesVariable or field, e.g. 'Kp_12' or 'Table.Value'
scopeNo'base' for the MATLAB base workspace, or the name of a loaded Simulink model for that model's workspacebase
valueYesNumber, string, list or nested list (matrix)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.9/5.0
Behavior4/5

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

Annotations already mark this as a destructive write, but the description adds genuinely non-obvious behavior: the old value is logged, the change is revertible via cm_revert_all, model-workspace edits stay in memory until cm_model_save, and an idle simulation is required. These are exactly the traits an agent needs before mutating state.

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, front-loaded with the action, then the revert/persistence semantics, then the precondition. No filler and every clause carries operational weight.

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?

With an output schema present, return values need no prose, and the description covers the remaining gaps: mutation durability, undo path, and the idle-simulation prerequisite. Nothing an agent must know to invoke this safely is missing.

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%, so name, scope and value are already documented with examples ('Kp_12', 'Table.Value') and accepted types. The description adds no parameter-level detail beyond the schema, so the baseline 3 applies.

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?

States a specific verb and resource ('Set a variable or field') with enough precision to distinguish it from the read-side sibling cm_get_workspace_var. However, it does not explicitly contrast itself with near-neighbors like cm_model_set, leaving the agent to infer the boundary from the scope parameter.

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?

It gives one real precondition ('Requires an idle simulation') and names follow-on tools (cm_revert_all, cm_model_save), which is useful implied usage. But it never states when to choose this over cm_model_set or cm_edit for the same underlying change, so selection guidance is only partial.

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