BlockWerk
Build, run and analyse block-diagram simulations: PID, Bode, FFT, optimisation and code export.
我该使用它吗
质量与安全性
发现(2)
- LOW在 get_architect_memory 中
- LOW在 get_engine_status 中
基于对工具定义和协议合规性的自动分析。
上下文开销
这是每次将服务器的工具加载到模型上下文窗口时所消耗的大致 token 数。数值越高,可用于其他任务的注意力就越少。
安装
一键安装
将以下内容添加到你的 `claude_desktop_config.json` 文件中:
{
"mcpServers": {
"mcp": {
"url": "https://blockwerk-mcp-worker.blockwerk.workers.dev/"
}
}
}远程端点
https://blockwerk-mcp-worker.blockwerk.workers.dev/streamable-http它能做什么
工具清单
工具(42)
🟢describe_canvas(compact)
Returns a structured description of all blocks and connections currently on the canvas. Set "compact" to true for a token-efficient summary.
输入模式
{
"type": "object",
"properties": {
"compact": {
"type": "boolean",
"description": "If true, returns a minimal description without full parameter details."
}
},
"$schema": "http://json-schema.org/draft-07/schema#"
}🟢get_available_blocks(filter)
Returns the block types in the library with their descriptions, configurable parameters, and exact input/output port IDs. Without a filter it returns a compact list of all types; with a list of type IDs it returns full details for those types. Example port IDs: Step out "out"; Sum in "in", out "out"; Gain in "in", out "out"; PIDController in "error","reset", out "out"; uPlotDisplay in "signal". Common aliases (e.g. "in" for PID error, "in" for uPlotDisplay signal, "+" / "-" for Subtraction) are resolved automatically.
输入模式
{
"type": "object",
"properties": {
"filter": {
"type": "array",
"items": {
"type": "string"
},
"description": "Optional: List of block type IDs to get full details for. If omitted, returns a compact list of all blocks."
}
},
"$schema": "http://json-schema.org/draft-07/schema#"
}🟡add_block(type, x, y)
Add a new block to the canvas. Returns the new block ID.
输入模式
{
"type": "object",
"properties": {
"type": {
"type": "string",
"description": "Block type from the library, e.g. \"PIDController\", \"Gain\", \"Integrator\""
},
"x": {
"type": "number",
"description": "Horizontal position in canvas pixels"
},
"y": {
"type": "number",
"description": "Vertical position in canvas pixels"
}
},
"required": [
"type",
"x",
"y"
],
"$schema": "http://json-schema.org/draft-07/schema#"
}⚪connect_blocks(fromBlockId, fromPortId, toBlockId, toPortId)
Connect an output port of one block to an input port of another. Automatically resolves common port aliases (e.g., "in" -> "signal" for uPlotDisplay, "in" -> "error" for PIDController, "+" / "-" for Subtraction).
输入模式
{
"type": "object",
"properties": {
"fromBlockId": {
"type": "string",
"description": "ID of the source block"
},
"fromPortId": {
"type": "string",
"description": "Output port ID of the source block, e.g. \"out\" (aliases like \"signal\", \"y\" are supported)"
},
"toBlockId": {
"type": "string",
"description": "ID of the destination block"
},
"toPortId": {
"type": "string",
"description": "Input port ID of the destination block, e.g. \"in\" (aliases like \"signal\" or PID \"error\" are supported)"
}
},
"required": [
"fromBlockId",
"fromPortId",
"toBlockId",
"toPortId"
],
"$schema": "http://json-schema.org/draft-07/schema#"
}🟡update_params(blockId, params)
Update one or more parameters of an existing block.
输入模式
{
"type": "object",
"properties": {
"blockId": {
"type": "string",
"description": "ID of the block to update"
},
"params": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {},
"description": "Key-value pairs of parameter names and their new values"
}
},
"required": [
"blockId",
"params"
],
"$schema": "http://json-schema.org/draft-07/schema#"
}🔴delete_block(blockId)
Delete a block and all its connections from the canvas. This is a destructive action that asks the user for approval in the BlockWerk tab.
输入模式
{
"type": "object",
"properties": {
"blockId": {
"type": "string",
"description": "ID of the block to delete"
}
},
"required": [
"blockId"
],
"$schema": "http://json-schema.org/draft-07/schema#"
}🔴load_diagram(json)
Atomically replaces the entire canvas with a complete diagram defined as a BlockWerk project JSON string. The JSON has a "blocks" array (each block needs a unique "id" and "type"; "x"/"y"/"params" are optional) and a "connections" array (each connection needs a unique "id" plus "fromBlockId", "fromPortId", "toBlockId", "toPortId"; a missing id fails validation of the whole load). Block types and port ids are listed by get_available_blocks. This is a destructive action that asks the user for approval in the BlockWerk tab.
输入模式
{
"type": "object",
"properties": {
"json": {
"type": "string",
"description": "Full BlockWerk project JSON, e.g. {\"blocks\":[{\"id\":\"b1\",\"type\":\"Step\",\"x\":100,\"y\":100,\"params\":{}},{\"id\":\"b2\",\"type\":\"Integrator\",\"x\":300,\"y\":100,\"params\":{}}],\"connections\":[{\"id\":\"c1\",\"fromBlockId\":\"b1\",\"fromPortId\":\"out\",\"toBlockId\":\"b2\",\"toPortId\":\"in\"}]}"
}
},
"required": [
"json"
],
"$schema": "http://json-schema.org/draft-07/schema#"
}🟢export_diagram
Exports the current canvas project as a complete BlockWerk JSON string.
输入模式
{
"type": "object",
"properties": {},
"$schema": "http://json-schema.org/draft-07/schema#"
}🟢get_share_link
Returns a link that opens the current diagram on the BlockWerk canvas. The whole project travels compressed inside the URL, so it needs no account and nothing is uploaded. Opening the link in a browser shows the diagram, where the simulation can be run.
输入模式
{
"type": "object",
"properties": {},
"$schema": "http://json-schema.org/draft-07/schema#"
}🔴clear_canvas
Remove all blocks and connections from the canvas. This is a destructive action that asks the user for approval in the BlockWerk tab.
输入模式
{
"type": "object",
"properties": {},
"$schema": "http://json-schema.org/draft-07/schema#"
}⚪tidy_layout
Automatically rearrange all blocks on the canvas into a clean, left-to-right flow.
输入模式
{
"type": "object",
"properties": {},
"$schema": "http://json-schema.org/draft-07/schema#"
}🔴batch_commands(commands)
Executes multiple canvas manipulation and background job commands in a single round-trip. Use "handle" strings to refer to blocks added earlier in the same batch. When adding TextNote annotations, set "anchors" to the handles/IDs of the described blocks so auto-layout keeps each note next to them.
输入模式
{
"type": "object",
"properties": {
"commands": {
"type": "array",
"items": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"add_block",
"move_block",
"connect_blocks",
"update_params",
"delete_block",
"tidy_layout",
"clear_canvas",
"start_optimization",
"get_job_status",
"cancel_job"
]
},
"blockType": {
"type": "string"
},
"x": {
"type": "number"
},
"y": {
"type": "number"
},
"handle": {
"type": "string"
},
"blockId": {
"type": "string"
},
"fromBlockId": {
"type": "string"
},
"fromPortId": {
"type": "string"
},
"toBlockId": {
"type": "string"
},
"toPortId": {
"type": "string"
},
"params": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {}
},
"anchors": {
"type": "array",
"items": {
"type": "string"
},
"description": "For add_block of a TextNote: handles/IDs of the blocks the note describes. Auto-layout and drag then keep the note beside those blocks."
},
"paramName": {
"type": "string"
},
"min": {
"type": "number"
},
"max": {
"type": "number"
},
"measureBlockId": {
"type": "string"
},
"setpoint": {
"type": "number"
},
"objective": {
"type": "string",
"enum": [
"iae",
"overshoot",
"settling_time"
]
},
"maxIterations": {
"type": "number"
},
"jobId": {
"type": "string"
}
},
"required": [
"type"
]
}
}
},
"required": [
"commands"
],
"$schema": "http://json-schema.org/draft-07/schema#"
}🟢analyze_topology
Analyzes the block diagram structure: detects feedback loops, signal paths, and system order.
输入模式
{
"type": "object",
"properties": {},
"$schema": "http://json-schema.org/draft-07/schema#"
}🟢get_signal_data(blockId, channel)
Returns time series data from a Scope block output for analysis.
输入模式
{
"type": "object",
"properties": {
"blockId": {
"type": "string",
"description": "ID of the Scope block"
},
"channel": {
"type": "number",
"description": "Channel index (default: 0)"
}
},
"required": [
"blockId"
],
"$schema": "http://json-schema.org/draft-07/schema#"
}🟢calculate_metrics(blockId, setpoint)
Calculates step response metrics from signal data: rise time, settling time, overshoot percentage, and steady-state error.
输入模式
{
"type": "object",
"properties": {
"blockId": {
"type": "string",
"description": "ID of the Scope block"
},
"setpoint": {
"type": "number",
"description": "Target setpoint value (default: 1)"
}
},
"required": [
"blockId"
],
"$schema": "http://json-schema.org/draft-07/schema#"
}🟢get_analysis_measurements(blockId)
Retrieves the currently active pinned measurements and their computed values across plotted signals in the Analysis panel.
输入模式
{
"type": "object",
"properties": {
"blockId": {
"type": "string",
"description": "Optional blockId or signalId filter"
}
},
"$schema": "http://json-schema.org/draft-07/schema#"
}🟢evaluate_spec_mask(blockId, setpoint, maxOvershootPercent, maxSettlingTime, maxRiseTime, ...)
Evaluates signal data against automated design specifications and tolerance corridors (rise time, settling time, overshoot %, steady-state error, min/max limits).
输入模式
{
"type": "object",
"properties": {
"blockId": {
"type": "string",
"description": "ID of the Scope or signal source block"
},
"setpoint": {
"type": "number",
"description": "Target setpoint value (default: 1)"
},
"maxOvershootPercent": {
"type": "number",
"description": "Maximum allowable overshoot %"
},
"maxSettlingTime": {
"type": "number",
"description": "Maximum allowable settling time (seconds)"
},
"maxRiseTime": {
"type": "number",
"description": "Maximum allowable rise time (seconds)"
},
"maxSteadyStateError": {
"type": "number",
"description": "Maximum allowable steady-state error"
},
"lowerLimit": {
"type": "number",
"description": "Absolute lower bound corridor"
},
"upperLimit": {
"type": "number",
"description": "Absolute upper bound corridor"
}
},
"required": [
"blockId"
],
"$schema": "http://json-schema.org/draft-07/schema#"
}🟢get_architect_memory
Returns the persistent memory object of the Architect.
输入模式
{
"type": "object",
"properties": {},
"$schema": "http://json-schema.org/draft-07/schema#"
}🟡update_architect_memory(updates)
Updates the persistent memory of the Architect. Provide a JSON object with keys to update/merge.
输入模式
{
"type": "object",
"properties": {
"updates": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {},
"description": "Keys and values to store"
}
},
"required": [
"updates"
],
"$schema": "http://json-schema.org/draft-07/schema#"
}🟢validate_engineering_units
Checks the consistency of engineering units across the diagram. Detects incompatible connections and missing units.
输入模式
{
"type": "object",
"properties": {},
"$schema": "http://json-schema.org/draft-07/schema#"
}🟢validate_canvas
Performs pre-flight topological and numerical integrity checks on the canvas. Detects unconnected required input ports, isolated blocks, parameter domain anomalies, and direct algebraic feedthrough loops.
输入模式
{
"type": "object",
"properties": {},
"$schema": "http://json-schema.org/draft-07/schema#"
}🟢get_canvas_preview(type)
Captures a visual screenshot preview of the canvas branded with the official BlockWerk watermark badge and returns the live interactive URL to view and edit the diagram online.
输入模式
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"canvas",
"scope",
"combined"
],
"description": "Which visual region to capture: \"canvas\", \"scope\", or \"combined\" (default: \"combined\")."
}
},
"$schema": "http://json-schema.org/draft-07/schema#"
}🟢get_templates(category, interactive)
Lists the built-in, verified BlockWerk diagrams: classic control systems (PID loop, cruise control, inverted pendulum), signal processing, electrical and physics models. Each entry gives an id, what the diagram does, its difficulty and the blocks it uses. Returns metadata only; load_template puts a diagram on the canvas by id.
输入模式
{
"type": "object",
"properties": {
"category": {
"type": "string",
"enum": [
"Control Systems",
"Signal Processing",
"Physics",
"Electrical"
],
"description": "Optional filter by category."
},
"interactive": {
"type": "boolean",
"description": "If true, only diagrams with live on-canvas controls (sliders, joystick, keyboard) meant to be driven while the simulation runs."
}
},
"$schema": "http://json-schema.org/draft-07/schema#"
}🔴load_template(templateId)
Replaces the entire canvas with one of the built-in verified diagrams, by id from get_templates. The template carries its topology, parameters and simulation settings. Returns the block and connection counts, the verified simulation settings, and the attribution when the model is based on third-party material. This is a destructive action that asks the user for approval in the BlockWerk tab.
输入模式
{
"type": "object",
"properties": {
"templateId": {
"type": "string",
"description": "Template id from get_templates, e.g. \"inverted_pendulum\" or \"pid_loop\"."
}
},
"required": [
"templateId"
],
"$schema": "http://json-schema.org/draft-07/schema#"
}⚪run_simulation(duration, sampleTime, reason)
Triggers a new simulation run with the current canvas state and settings, refreshing the signal data.
输入模式
{
"type": "object",
"properties": {
"duration": {
"type": "number",
"description": "Duration in seconds"
},
"sampleTime": {
"type": "number",
"description": "Optional custom step size (dt) for high frequency or stiff systems (e.g., 0.001)"
},
"reason": {
"type": "string",
"description": "User-facing explanation of why settings were changed (e.g., Nyquist constraint)"
}
},
"$schema": "http://json-schema.org/draft-07/schema#"
}🟢sweep_parameter(blockId, paramName, values, measureBlockId, setpoint)
Runs simulations across a list of values for one parameter, returning control quality metrics (IAE, overshoot, settling_time, steady_state_error) per value. Requires measureBlockId and setpoint.
输入模式
{
"type": "object",
"properties": {
"blockId": {
"type": "string",
"description": "ID of the block to tune"
},
"paramName": {
"type": "string",
"description": "Parameter key to vary (e.g., \"gain\", \"Kp\")"
},
"values": {
"type": "array",
"items": {
"type": "number"
},
"description": "List of values to test"
},
"measureBlockId": {
"type": "string",
"description": "Scope or Display block ID to read the controlled signal from"
},
"setpoint": {
"type": "number",
"description": "Expected final value for error calculation (default: 1)"
}
},
"required": [
"blockId",
"paramName",
"values"
],
"$schema": "http://json-schema.org/draft-07/schema#"
}⚪optimize_parameters(blockId, paramName, min, max, measureBlockId, ...)
Finds the optimal value for a single parameter using golden-section search. Minimizes IAE (integral absolute error), overshoot, or settling_time within a [min, max] range. Converges in about 10 simulations.
输入模式
{
"type": "object",
"properties": {
"blockId": {
"type": "string",
"description": "ID of the block containing the parameter to tune"
},
"paramName": {
"type": "string",
"description": "Parameter key to optimize (e.g., \"Kp\", \"gain\")"
},
"min": {
"type": "number",
"description": "Lower bound of the search range"
},
"max": {
"type": "number",
"description": "Upper bound of the search range"
},
"measureBlockId": {
"type": "string",
"description": "Scope or Display block ID to read the controlled signal from"
},
"setpoint": {
"type": "number",
"description": "Target steady-state value (default: 1)"
},
"objective": {
"type": "string",
"enum": [
"iae",
"overshoot",
"settling_time"
],
"description": "Metric to minimize (default: iae)"
},
"maxIterations": {
"type": "number",
"description": "Maximum simulations to run, 3–20 (default: 10)"
}
},
"required": [
"blockId",
"paramName",
"min",
"max",
"measureBlockId"
],
"$schema": "http://json-schema.org/draft-07/schema#"
}⚪optimize_multi_parameter(targets, measureBlockId, setpoint, objective, maxIterations)
Optimizes 2–6 parameters simultaneously using Nelder-Mead simplex search, for example Kp, Ki and Kd of a PID controller at once.
输入模式
{
"type": "object",
"properties": {
"targets": {
"type": "array",
"items": {
"type": "object",
"properties": {
"blockId": {
"type": "string"
},
"paramName": {
"type": "string"
},
"min": {
"type": "number"
},
"max": {
"type": "number"
}
},
"required": [
"blockId",
"paramName",
"min",
"max"
]
},
"description": "Parameters to optimize simultaneously"
},
"measureBlockId": {
"type": "string",
"description": "Scope or Display block to read the controlled signal from"
},
"setpoint": {
"type": "number",
"description": "Target steady-state value (default: 1)"
},
"objective": {
"type": "string",
"enum": [
"iae",
"overshoot",
"settling_time"
],
"description": "Metric to minimize (default: iae)"
},
"maxIterations": {
"type": "number",
"description": "Max simulations to run, 5–60 (default: 30)"
}
},
"required": [
"targets",
"measureBlockId"
],
"$schema": "http://json-schema.org/draft-07/schema#"
}⚪auto_tune_pid(pidBlockId, measureBlockId, setpoint, controlType, minGain, ...)
Automatically tunes a PID controller using the Ziegler-Nichols ultimate cycle method. Finds the ultimate gain (Ku) and oscillation period (Tu) via binary search, then applies ZN formulas. No prior knowledge of the plant required.
输入模式
{
"type": "object",
"properties": {
"pidBlockId": {
"type": "string",
"description": "ID of the PIDController block to tune"
},
"measureBlockId": {
"type": "string",
"description": "Scope or Display block showing the controlled variable"
},
"setpoint": {
"type": "number",
"description": "Desired setpoint value (default: 1)"
},
"controlType": {
"type": "string",
"enum": [
"P",
"PI",
"PID"
],
"description": "Controller type to tune for (default: PID)"
},
"minGain": {
"type": "number",
"description": "Lower bound for Ku search (default: 0.1)"
},
"maxGain": {
"type": "number",
"description": "Upper bound for Ku search (default: 200)"
}
},
"required": [
"pidBlockId",
"measureBlockId"
],
"$schema": "http://json-schema.org/draft-07/schema#"
}🟢identify_fopdt(blockId, stepAmplitude, stepTime)
Analyzes a step response from a plant to identify its First-Order Plus Dead Time (FOPDT) parameters: Gain (K), Time Constant (tau), and Dead Time (theta). Requires a completed simulation with a step input connected to the plant. Returns the calculated parameters.
输入模式
{
"type": "object",
"properties": {
"blockId": {
"type": "string",
"description": "Scope or Display block ID showing the plant output"
},
"stepAmplitude": {
"type": "number",
"description": "Amplitude of the step input (default: 1)"
},
"stepTime": {
"type": "number",
"description": "Time when the step input occurred (default: 0)"
}
},
"required": [
"blockId"
],
"$schema": "http://json-schema.org/draft-07/schema#"
}⚪start_optimization(blockId, paramName, min, max, measureBlockId, ...)
Start a parameter optimization job in the background.
输入模式
{
"type": "object",
"properties": {
"blockId": {
"type": "string"
},
"paramName": {
"type": "string"
},
"min": {
"type": "number"
},
"max": {
"type": "number"
},
"measureBlockId": {
"type": "string"
},
"setpoint": {
"type": "number"
},
"objective": {
"type": "string",
"enum": [
"iae",
"overshoot",
"settling_time"
]
},
"maxIterations": {
"type": "number"
}
},
"required": [
"blockId",
"paramName",
"min",
"max",
"measureBlockId"
],
"$schema": "http://json-schema.org/draft-07/schema#"
}🟢get_job_status(jobId)
Check the status and progress of a background job.
输入模式
{
"type": "object",
"properties": {
"jobId": {
"type": "string"
}
},
"required": [
"jobId"
],
"$schema": "http://json-schema.org/draft-07/schema#"
}🔴cancel_job(jobId)
Cancel a running background job.
输入模式
{
"type": "object",
"properties": {
"jobId": {
"type": "string"
}
},
"required": [
"jobId"
],
"$schema": "http://json-schema.org/draft-07/schema#"
}🟢list_jobs
List all recent background jobs and their status.
输入模式
{
"type": "object",
"properties": {},
"$schema": "http://json-schema.org/draft-07/schema#"
}🟢explain_simulation(stabilityMargins)
Analyze the last completed simulation and return a structured diagnosis: signal anomalies (NaN, divergence, oscillation), solver health (rejection rate, efficiency), algebraic loops, and optional stability margins. Returns JSON with severity-tagged findings and actionable suggestions.
输入模式
{
"type": "object",
"properties": {
"stabilityMargins": {
"type": "object",
"properties": {
"gainMarginDb": {
"type": "number"
},
"phaseMarginDeg": {
"type": "number"
},
"stable": {
"type": "boolean"
}
},
"required": [
"gainMarginDb",
"phaseMarginDeg",
"stable"
],
"description": "Optional pre-computed stability margins from a Bode sweep. If omitted, stability analysis is skipped."
}
},
"$schema": "http://json-schema.org/draft-07/schema#"
}🟢get_bode_data(inputBlockId, outputBlockId, startFreq, endFreq, pointsPerDecade)
Computes magnitude and phase frequency response (Bode data) between two blocks. Traces path backwards from outputBlockId. Returns analytic response if the path contains only linear blocks, otherwise runs numerical sweep.
输入模式
{
"type": "object",
"properties": {
"inputBlockId": {
"type": "string",
"description": "ID of the input source block"
},
"outputBlockId": {
"type": "string",
"description": "ID of the output measurement block"
},
"startFreq": {
"type": "number",
"description": "Start frequency in rad/s (default: 0.1)"
},
"endFreq": {
"type": "number",
"description": "End frequency in rad/s (default: 100)"
},
"pointsPerDecade": {
"type": "number",
"description": "Number of points per decade (default: 10)"
}
},
"required": [
"inputBlockId",
"outputBlockId"
],
"$schema": "http://json-schema.org/draft-07/schema#"
}🟢get_fft_data(blockId, channel)
Computes FFT (frequency spectrum) of a Scope signal. Returns frequencies and magnitudes.
输入模式
{
"type": "object",
"properties": {
"blockId": {
"type": "string",
"description": "ID of the Scope block"
},
"channel": {
"type": "number",
"description": "Channel index (default: 0)"
}
},
"required": [
"blockId"
],
"$schema": "http://json-schema.org/draft-07/schema#"
}🟢get_engine_status
Returns the simulation engine status, including supported solvers, active background jobs, and compilation/WASM capabilities.
输入模式
{
"type": "object",
"properties": {},
"$schema": "http://json-schema.org/draft-07/schema#"
}🟢generate_code(modelName, sampleTime, target, encapsulateSubsystems)
Generates standalone production code (C++, Python, Rust) from the current canvas diagram. Returns structured code files, interfaces (inputs/outputs), execution order, and diagnostics.
输入模式
{
"type": "object",
"properties": {
"modelName": {
"type": "string",
"description": "Name of the generated model class/module (e.g., \"MotorController\", default: \"BlockWerkModel\")"
},
"sampleTime": {
"type": "number",
"description": "Optional custom step size in seconds (default: current canvas sampleTime)"
},
"target": {
"type": "string",
"enum": [
"all",
"cpp",
"python",
"rust"
],
"description": "Filter code generation to a specific target language (default: \"all\")"
},
"encapsulateSubsystems": {
"type": "boolean",
"description": "Whether to generate encapsulated subsystem classes (default: false)"
}
},
"$schema": "http://json-schema.org/draft-07/schema#"
}🔴undo_last_ai_action
Undoes the last canvas modification made by the AI (add block, connect, delete, update parameter).
输入模式
{
"type": "object",
"properties": {},
"$schema": "http://json-schema.org/draft-07/schema#"
}🔴redo_last_ai_action
Redoes the last undone canvas modification.
输入模式
{
"type": "object",
"properties": {},
"$schema": "http://json-schema.org/draft-07/schema#"
}🟢get_ai_history
Returns the list of recent canvas operations performed by the AI, showing what can be undone.
输入模式
{
"type": "object",
"properties": {},
"$schema": "http://json-schema.org/draft-07/schema#"
}社区
证据