-
Notifications
You must be signed in to change notification settings - Fork 0
MCP Tools Reference
The server exposes 20 built-in tools plus any custom tools defined in your custom_tools.yaml.
Execute MATLAB code in the session's engine.
| Parameter | Type | Required | Description |
|---|---|---|---|
code |
string | yes | MATLAB code to execute |
Behavior:
- Runs synchronously if it completes within
sync_timeout(default 30s) - Auto-promotes to async if it exceeds the timeout
- Returns inline result for sync, or
job_idfor async
Example response (sync):
{
"status": "completed",
"output": "ans =\n 15",
"execution_time": 0.23,
"variables": {
"x": {"class": "double", "size": [1, 1], "value": 5}
}
}Example response (async promotion):
{
"status": "running",
"job_id": "abc123-def456",
"message": "Job promoted to async execution"
}Lint MATLAB code using checkcode/mlint.
| Parameter | Type | Required | Description |
|---|---|---|---|
code |
string | yes | MATLAB code to check |
Example response:
{
"issues": [
{
"line": 3,
"column": 5,
"message": "Variable 'x' might be unused",
"severity": "warning"
},
{
"line": 7,
"column": 12,
"message": "Missing space after comma",
"severity": "info"
}
],
"summary": "1 warning(s), 1 info(s), 0 error(s)"
}Get variables in the current MATLAB workspace.
| Parameter | Type | Required | Description |
|---|---|---|---|
| (none) | — | — | — |
Returns the output of MATLAB's whos command, showing all variables, their sizes, and data types.
Example response:
{
"workspace": "Name Size Bytes Class\n A 5x5 200 double array\n b 1x1 8 double\n result 10x1 80 double array",
"variables": [
{"name": "A", "size": "5x5", "bytes": 200, "class": "double"},
{"name": "b", "size": "1x1", "bytes": 8, "class": "double"},
{"name": "result", "size": "10x1", "bytes": 80, "class": "double"}
]
}Get status and progress of a running job.
| Parameter | Type | Required | Description |
|---|---|---|---|
job_id |
string | yes | Job ID from execute_code
|
Example response:
{
"job_id": "abc123-def456",
"status": "running",
"progress": 65.0,
"message": "Trial 650000/1000000",
"elapsed_seconds": 120.5,
"state": "running"
}Get the full result of a completed job.
| Parameter | Type | Required | Description |
|---|---|---|---|
job_id |
string | yes | Job ID |
Example response (completed):
{
"status": "completed",
"job_id": "abc123-def456",
"output": "Simulation finished successfully",
"execution_time": 245.67,
"variables": {
"results": {"class": "struct", "size": [1, 1]}
}
}Example response (failed):
{
"status": "failed",
"job_id": "abc123-def456",
"error": "Index exceeds array dimensions",
"error_trace": "Error in myScript (line 12)\n x(100) = 5;"
}Cancel a pending or running job.
| Parameter | Type | Required | Description |
|---|---|---|---|
job_id |
string | yes | Job ID |
Example response:
{
"status": "cancelled",
"job_id": "abc123-def456",
"message": "Job cancelled successfully"
}List all jobs in the current session.
| Parameter | Type | Required | Description |
|---|---|---|---|
| (none) | — | — | — |
Example response:
{
"jobs": [
{
"job_id": "abc123-def456",
"status": "completed",
"created_at": "2024-01-15T10:30:00Z",
"execution_time": 15.34
},
{
"job_id": "xyz789-uvw012",
"status": "running",
"created_at": "2024-01-15T10:31:00Z",
"elapsed_seconds": 45.2
}
],
"total": 2
}List available MATLAB toolboxes.
| Parameter | Type | Required | Description |
|---|---|---|---|
| (none) | — | — | — |
Returns the output of MATLAB's ver command along with toolbox configuration information.
Example response:
{
"output": "MATLAB Version 9.13 (R2022b)",
"toolboxes": [
{
"name": "MATLAB",
"version": "9.13"
},
{
"name": "Signal Processing Toolbox",
"version": "9.14"
},
{
"name": "Statistics and Machine Learning Toolbox",
"version": "12.4"
}
]
}List functions in a specific MATLAB toolbox.
| Parameter | Type | Required | Description |
|---|---|---|---|
toolbox_name |
string | yes | Name of the toolbox (e.g., "signal", "stats") |
Example response:
{
"toolbox": "Signal Processing Toolbox",
"output": "Signal Processing Toolbox\n Filters\n butter - Butterworth filter design\n fir1 - FIR filter design using the window method\n Analysis\n periodogram - Power spectral density using Welch method"
}Get MATLAB help text for any function.
| Parameter | Type | Required | Description |
|---|---|---|---|
function_name |
string | yes | Name of the function |
Example response:
{
"function": "sin",
"help_text": "SIN Sine of argument in radians.\n SIN(X) is the sine of the elements of X.\n\n See also asin, sind.\n\n Reference page for sin\n Other functions named sin"
}Upload a data file to the session's temporary directory.
| Parameter | Type | Required | Description |
|---|---|---|---|
filename |
string | yes | Name of the file to create |
content_base64 |
string | yes | File content as base64-encoded string |
Example response:
{
"filename": "data.csv",
"path": "/tmp/matlab_session_abc123/data.csv",
"size_bytes": 1024,
"message": "File uploaded successfully"
}Delete a file from the session's temporary directory.
| Parameter | Type | Required | Description |
|---|---|---|---|
filename |
string | yes | Name of the file to delete |
Example response:
{
"filename": "data.csv",
"message": "File deleted successfully"
}List files in the session's temporary directory.
| Parameter | Type | Required | Description |
|---|---|---|---|
| (none) | — | — | — |
Example response:
{
"files": [
{
"name": "data.csv",
"path": "/tmp/matlab_session_abc123/data.csv",
"size_bytes": 2048
},
{
"name": "myScript.m",
"path": "/tmp/matlab_session_abc123/myScript.m",
"size_bytes": 512
},
{
"name": "results.mat",
"path": "/tmp/matlab_session_abc123/results.mat",
"size_bytes": 4096
}
],
"total": 3
}Read a MATLAB .m script file from the session's temporary directory.
| Parameter | Type | Required | Description |
|---|---|---|---|
filename |
string | yes | Name of the .m file to read |
Example response:
{
"filename": "myScript.m",
"content": "function result = myScript(x)\n% Calculate something\nresult = x * 2 + 5;\nend"
}Read a data file from the session's temporary directory.
| Parameter | Type | Required | Description |
|---|---|---|---|
filename |
string | yes | Name of the file (.mat, .csv, .json, .txt, .xlsx) |
format |
string | no | Read format: "summary" (default) or "raw" |
Behavior:
- For
.matfiles: "summary" shows variable names/sizes/types; "raw" returns base64-encoded content - For text files (.csv, .json, .txt): Returns content inline
- For .xlsx files: Returns summary of sheets and data
Example response (MAT summary):
{
"filename": "results.mat",
"format": "summary",
"variables": [
{
"name": "signal",
"class": "double",
"size": [1, 1000],
"bytes": 8000
},
{
"name": "metadata",
"class": "struct",
"size": [1, 1],
"bytes": 256
}
]
}Example response (CSV):
{
"filename": "data.csv",
"content": "time,value,status\n0,10.5,ok\n1,11.2,ok\n2,10.8,ok",
"rows": 3
}Read an image file from the session's temporary directory.
| Parameter | Type | Required | Description |
|---|---|---|---|
filename |
string | yes | Name of the image file (.png, .jpg, .gif) |
Returns the image as an inline content block that renders in agent UIs.
Example response:
{
"filename": "plot.png",
"mime_type": "image/png",
"data": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==",
"size_bytes": 68
}Get the current status of the MATLAB engine pool.
| Parameter | Type | Required | Description |
|---|---|---|---|
| (none) | — | — | — |
Example response:
{
"total_engines": 4,
"available_engines": 2,
"busy_engines": 2,
"max_engines": 8,
"pool_type": "ProcessPool"
}Get comprehensive server metrics including pool, jobs, sessions, and system stats.
| Parameter | Type | Required | Description |
|---|---|---|---|
| (none) | — | — | — |
Example response:
{
"timestamp": "2024-01-15T10:35:00Z",
"pool": {
"total_engines": 4,
"available_engines": 2,
"busy_engines": 2,
"max_engines": 8
},
"jobs": {
"total": 15,
"running": 2,
"completed": 12,
"failed": 1
},
"sessions": {
"total": 3,
"active": 3
},
"system": {
"cpu_percent": 45.2,
"memory_percent": 62.8,
"uptime_seconds": 86400
}
}Get server health status with issue detection.
| Parameter | Type | Required | Description |
|---|---|---|---|
| (none) | — | — | — |
Example response (healthy):
{
"status": "healthy",
"summary": "All systems operational",
"timestamp": "2024-01-15T10:35:00Z",
"checks": {
"pool": "healthy",
"jobs": "healthy",
"memory": "healthy"
}
}Example response (degraded):
{
"status": "degraded",
"summary": "High memory usage detected",
"timestamp": "2024-01-15T10:35:00Z",
"issues": [
{
"component": "memory",
"severity": "warning",
"message": "Memory usage at 85%"
}
]
}Get recent server errors and notable events for diagnosing issues.
| Parameter | Type | Required | Description |
|---|---|---|---|
limit |
integer | no | Maximum number of entries to return (default 20) |
Example response:
{
"errors": [
{
"timestamp": "2024-01-15T10:34:22Z",
"level": "error",
"component": "job_executor",
"message": "Job abc123 failed: Index exceeds array dimensions"
},
{
"timestamp": "2024-01-15T10:32:15Z",
"level": "warning",
"component": "pool",
"message": "Engine pool running at 95% capacity"
}
],
"total": 2
}Custom tools can be defined in your custom_tools.yaml configuration file. These tools are dynamically registered at runtime and extend the built-in tool set. Custom tools follow the same parameter and response conventions as built-in tools and are accessible through the same MCP interface.