Skip to main content
Glama

Read a workspace variable

cm_get_workspace_var
Read-only

Retrieve the value of a MATLAB base or Simulink model workspace variable or object field by name, returning a description for objects instead of converting them.

Instructions

Value of a variable or field. MATLAB objects are described, not converted: read their fields.

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

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.5/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true and openWorldHint=false, so safety is covered. The description still earns credit by disclosing return semantics: MATLAB objects come back as descriptions rather than converted values, and their fields must be read. That is non-obvious behavior an agent needs before calling, and it is not in the annotations.

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?

Two tight sentences, front-loaded with purpose and followed by the object-handling caveat; nothing is padded. The first sentence is a bare noun fragment, which is minor but slightly reduces polish rather than clarity.

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 read-only two-parameter getter with a fully documented schema and no output schema, the description covers purpose, the object-field reading pattern, and the safety profile is carried by annotations. Return-value formatting beyond the object note is not described, but that gap is small given the tool's simplicity.

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%, and both parameters (name, scope) carry their own descriptions with examples and defaults, so the schema does the heavy lifting. The description adds no syntax or format detail beyond that, which is the baseline-3 case.

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?

Combined with the title 'Read a workspace variable', the description states a clear verb+resource: it retrieves the value of a workspace variable or one of its fields. However it never distinguishes itself from the nearby cm_list_workspace_vars (enumerate) or cm_set_workspace_var (write), leaving differentiation to inference from the name.

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

Usage Guidelines2/5

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

There is no explicit when-to-use or when-not-to-use guidance and no named alternative. The agent is not told that cm_list_workspace_vars enumerates names or that cm_set_workspace_var is the write counterpart, so selection relies entirely on the tool name.

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