Bug Report
Reporter: agent
Date: 2026-07-24
Severity: High
Reproducibility: Always
Summary
The model_edit MCP tool rejects calls containing add_block operations with the error argument "layout_mode" not provided, even though layout_mode is declared as an optional parameter in the tool schema. The error fires unconditionally whenever add_block operations are present, regardless of whether layout_mode was actually supplied. The error message does not indicate that layout_mode is conditionally required.
Expected Behavior
layout_mode should be treated as a truly optional parameter as declared in the tool schema. When layout_mode is provided, the call should proceed to execution. When it is omitted with add_block operations, the tool should either accept the call (using a sensible default) or produce a clear error stating that layout_mode is required for add_block operations specifically.
Actual Behavior
Every call to model_edit that includes add_block operations fails with the error argument "layout_mode" not provided. This happens even when layout_mode is explicitly included in the call. The error message is generic — it does not specify which operation or parameter triggered the requirement, making it impossible to diagnose without trial and error.
When layout_mode is explicitly provided, a different error appears about #ref scoping (#StabilityControlSystem not found), which may be a separate issue or a cascading effect of the parameter validation failing first.
Reproduction Steps
Prerequisites:
- MATLAB R2025b Update 3 with Simulink
- SATK 2026.07.22 installed
- A Simulink model loaded in the current session (e.g.,
StabilityControlSystem)
model_read tool available (SATK initialized)
- Call
model_edit with an add_block operation and a ref parameter, without providing layout_mode:
model_edit(
model: "StabilityControlSystem",
scope: "blk_131",
operations: [{op: "add_block", params: {Position: [50,50,130,90]}, ref: "testblk", type: "Constant", parent: "StabilityControlSystem/VehiclePlant"}]
)
Observe: Error argument "layout_mode" not provided
- Call
model_edit with the same add_block operation but explicitly include layout_mode: "incremental":
model_edit(
model: "StabilityControlSystem",
scope: "blk_131",
layout_mode: "incremental",
operations: [{op: "add_block", params: {Position: [50,50,130,90]}, ref: "testblk", type: "Constant", parent: "StabilityControlSystem/VehiclePlant"}]
)
Observe: A different error — #StabilityControlSystem not found — ref/#ref are scoped to a single model_edit call
- Note that
create_subsystem and configure operations succeed without layout_mode, but add_block does not.
Minimal Reproduction
# In any agent session with Simulink MCP tools available:
# Call model_edit with add_block + ref, no layout_mode → "argument layout_mode not provided"
# Call model_edit with add_block + ref + layout_mode → "#ref not found" scoping error
Environment
Toolkit & Agent
| Detail |
Value |
| SATK Version |
2026.07.22 |
| Agent / Client |
Claude Code CLI |
| Agent Workspace Root |
\simulinkTests |
| MCP Server Mode |
attach-to-existing (port 31516) |
| Available MCP Tools |
model_read, model_edit, model_overview, model_query_params, model_resolve_params, model_check, model_read_diagnostics, model_test, model_configure, evaluate_matlab_code, run_matlab_file, run_matlab_test_file, check_matlab_code, detect_matlab_toolboxes |
Skills
Skills · 0 ⊘ 0 ▶ 0 ✗ 0
filing-bug-reports · 1
Skill Conflict Analysis
N/A — fewer than 2 skills with bodies loaded into context
MATLAB
| Detail |
Value |
| MATLAB Version |
25.2.0.3123386 (R2025b) Update 3 |
| MATLAB Working Directory |
C:\simulinkTests |
| Simulink Version |
25.2 |
| Relevant Toolboxes |
Simulink 25.2 |
| setup.m Status |
N/A |
| Connector Port |
31516 |
Platform
| Detail |
Value |
| OS |
Windows 11 Home Version 10.0 (Build 26200) |
| Architecture |
win64 |
Error Output
argument "layout_mode" not provided
When layout_mode is explicitly provided:
[Autolayout] skip: model=StabilityControlSystem, scope=blk_131, empty_accumulated
ans =
'status: error
model: StabilityControlSystem
scope: blk_131
error_code: DEPENDENCY_ERROR
message: #StabilityControlSystem not found — ref/#ref are scoped to a single model_edit call. Use the blk_ID from the previous call's "created" map instead of #StabilityControlSystem.'
Impact
- Scope: All users calling
model_edit with add_block operations that use ref for intra-call block referencing.
- Workaround: Unclear. Providing
layout_mode changes the error but does not resolve the #ref scoping issue. It is not known whether add_block without ref works without layout_mode.
- Blocking: Blocks building subsystems incrementally — cannot add blocks to a newly created subsystem in a separate
model_edit call, which is the natural workflow for model construction.
Related Files
| File |
Relevance |
| .matlab\agentic-toolkits\simulink\tools\model_read\model_read.p |
SATK tool implementation — model_edit is likely defined here or in a sibling file |
| .matlab\agentic-toolkits\simulink\VERSION |
SATK version: 2026.07.22 |
Notes (optional)
create_subsystem and configure operations succeed without layout_mode. The constraint appears specific to add_block (and possibly delete, replace_block, disconnect).
- The tool schema declares
layout_mode as optional ("required": ["model", "targets", "params", "compile"] for model_query_params; for model_edit the required fields are ["model", "scope", "operations"]). The conditional requirement is not reflected in the schema or in any validation message.
- The
#ref scoping error when layout_mode is provided may be a distinct bug: ref is documented as scoped to a single model_edit call, but the error message references #StabilityControlSystem which is the model name in the parent string, not a ref — suggesting the error message may be conflating the parent path syntax with the #ref syntax.
- This may be a server-side validation issue in the SATK tool implementation rather than an agent-side problem.
Additional Context
Reproduced by attempting D02 — Spec-Driven Plant Model Creation for Closed-Loop Simulation slAgenticTaskExplorer exercise.
Bug Report
Reporter: agent
Date: 2026-07-24
Severity: High
Reproducibility: Always
Summary
The
model_editMCP tool rejects calls containingadd_blockoperations with the errorargument "layout_mode" not provided, even thoughlayout_modeis declared as an optional parameter in the tool schema. The error fires unconditionally wheneveradd_blockoperations are present, regardless of whetherlayout_modewas actually supplied. The error message does not indicate thatlayout_modeis conditionally required.Expected Behavior
layout_modeshould be treated as a truly optional parameter as declared in the tool schema. Whenlayout_modeis provided, the call should proceed to execution. When it is omitted withadd_blockoperations, the tool should either accept the call (using a sensible default) or produce a clear error stating thatlayout_modeis required foradd_blockoperations specifically.Actual Behavior
Every call to
model_editthat includesadd_blockoperations fails with the errorargument "layout_mode" not provided. This happens even whenlayout_modeis explicitly included in the call. The error message is generic — it does not specify which operation or parameter triggered the requirement, making it impossible to diagnose without trial and error.When
layout_modeis explicitly provided, a different error appears about#refscoping (#StabilityControlSystem not found), which may be a separate issue or a cascading effect of the parameter validation failing first.Reproduction Steps
Prerequisites:
StabilityControlSystem)model_readtool available (SATK initialized)model_editwith anadd_blockoperation and arefparameter, without providinglayout_mode:argument "layout_mode" not providedmodel_editwith the sameadd_blockoperation but explicitly includelayout_mode: "incremental":#StabilityControlSystem not found — ref/#ref are scoped to a single model_edit callcreate_subsystemandconfigureoperations succeed withoutlayout_mode, butadd_blockdoes not.Minimal Reproduction
Environment
Toolkit & Agent
Skills
Skills · 0 ⊘ 0 ▶ 0 ✗ 0
filing-bug-reports · 1
⊘ filing-bug-reports
testing-simulink-models · 1
⊘ testing-simulink-models
⊘ name-only · ▶ invoked · ✗ unregistered SATK
Skill Conflict Analysis
N/A — fewer than 2 skills with bodies loaded into context
MATLAB
Platform
Error Output
When
layout_modeis explicitly provided:Impact
model_editwithadd_blockoperations that usereffor intra-call block referencing.layout_modechanges the error but does not resolve the#refscoping issue. It is not known whetheradd_blockwithoutrefworks withoutlayout_mode.model_editcall, which is the natural workflow for model construction.Related Files
Notes (optional)
create_subsystemandconfigureoperations succeed withoutlayout_mode. The constraint appears specific toadd_block(and possiblydelete,replace_block,disconnect).layout_modeas optional ("required": ["model", "targets", "params", "compile"]formodel_query_params; formodel_editthe required fields are["model", "scope", "operations"]). The conditional requirement is not reflected in the schema or in any validation message.#refscoping error whenlayout_modeis provided may be a distinct bug:refis documented as scoped to a singlemodel_editcall, but the error message references#StabilityControlSystemwhich is the model name in theparentstring, not aref— suggesting the error message may be conflating theparentpath syntax with the#refsyntax.Additional Context
Reproduced by attempting D02 — Spec-Driven Plant Model Creation for Closed-Loop Simulation slAgenticTaskExplorer exercise.