-
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
}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"
}
],
"summary": "1 warning(s), 0 error(s)"
}Get variables in the current MATLAB workspace.
| Parameter | Type | Required | Description |
|---|---|---|---|
| (none) | — | — | — |
Returns the output of MATLAB's whos command, listing all variables with their sizes, classes, and byte counts.
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",
"status": "running",
"progress": 65.0,
"message": "Trial 650000/1000000",
"elapsed_seconds": 120.5
}Get the full result of a completed job.
| Parameter | Type | Required | Description |
|---|---|---|---|
job_id |
string | yes | Job ID |
Returns the complete result dict for completed jobs, or the error dict for failed jobs, including output, variables, and execution timing.
Cancel a pending or running job.
| Parameter | Type | Required | Description |
|---|---|---|---|
job_id |
string | yes | Job ID |
Attempts to cancel the underlying MATLAB future and marks the job as cancelled in the job tracker.
List all jobs in the current session.
| Parameter | Type | Required | Description |
|---|---|---|---|
| (none) | — | — | — |
Returns a list of job summaries including job IDs, status, and execution timing for all jobs in the current session.
List available MATLAB toolboxes (filtered by configuration).
| Parameter | Type | Required | Description |
|---|---|---|---|
| (none) | — | — | — |
Runs MATLAB's ver command and returns the output along with toolbox configuration information.
Example response:
{
"output": "MATLAB Version 23.2.1\n\nSignal Processing Toolbox...",
"toolboxes": [
{
"name": "Signal Processing Toolbox",
"version": "9.2"
}
]
}List functions in a specific MATLAB toolbox.
| Parameter | Type | Required | Description |
|---|---|---|---|
toolbox_name |
string | yes | Name of the toolbox |
Runs MATLAB's help <toolbox_name> command and returns the function list and documentation.
Get MATLAB help text for any function.
| Parameter | Type | Required | Description |
|---|---|---|---|
function_name |
string | yes | Name of the function |
Runs MATLAB's help <function_name> command and returns the full documentation.
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 | Base64-encoded file content |
The file is written to the session temp directory and can be accessed from MATLAB code.
Example response:
{
"status": "success",
"filename": "data.csv",
"path": "/tmp/matlab_session_xyz/data.csv",
"size_bytes": 1024
}Delete a file from the session's temporary directory.
| Parameter | Type | Required | Description |
|---|---|---|---|
filename |
string | yes | Name of the file to delete |
Only files in the session temp directory can be deleted. Non-existent files will return an error.
List all files in the session's temporary directory.
| Parameter | Type | Required | Description |
|---|---|---|---|
| (none) | — | — | — |
Returns names, sizes, and paths for all files in the session temp directory.
Example response:
{
"files": [
{
"name": "data.csv",
"size_bytes": 2048,
"path": "/tmp/matlab_session_xyz/data.csv"
},
{
"name": "results.mat",
"size_bytes": 5120,
"path": "/tmp/matlab_session_xyz/results.mat"
}
],
"total_files": 2
}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 |
Returns the file content as text. Use list_files to see available files.
Example response:
{
"filename": "myScript.m",
"content": "% My MATLAB script\nx = linspace(0, 2*pi, 100);\ny = sin(x);\nplot(x, y);"
}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 |
summary (default) or raw for .mat files |
For .mat files, 'summary' mode shows variable names, sizes, and types via MATLAB. 'raw' mode returns base64-encoded content. Text files return inline content.
Example response (summary):
{
"filename": "results.mat",
"format": "summary",
"variables": [
{
"name": "x",
"size": "[100 1]",
"type": "double"
}
]
}Example response (text file):
{
"filename": "data.csv",
"content": "x,y,z\n1,2,3\n4,5,6"
}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.
Get the current status of the MATLAB engine pool.
| Parameter | Type | Required | Description |
|---|---|---|---|
| (none) | — | — | — |
Returns the total, available, busy, and maximum engine counts.
Example response:
{
"total_engines": 4,
"available_engines": 2,
"busy_engines": 2,
"max_engines": 4
}Get comprehensive server metrics including pool, jobs, sessions, and system stats.
| Parameter | Type | Required | Description |
|---|---|---|---|
| (none) | — | — | — |
Returns detailed metrics about server health, resource utilization, and job activity.
Example response:
{
"pool": {
"total_engines": 4,
"available_engines": 2,
"busy_engines": 2
},
"jobs": {
"total": 150,
"running": 5,
"completed": 140,
"failed": 5
},
"sessions": {
"active": 3,
"total_created": 25
},
"system": {
"uptime_seconds": 86400,
"memory_usage_percent": 45.2
}
}Get server health status with issue detection.
| Parameter | Type | Required | Description |
|---|---|---|---|
| (none) | — | — | — |
Returns overall health status as healthy, degraded, or unhealthy, with details about any detected issues.
Example response:
{
"status": "healthy",
"checks": {
"pool": "ok",
"jobs": "ok",
"memory": "ok"
},
"issues": []
}Get recent server errors and notable events for diagnosing issues.
| Parameter | Type | Required | Description |
|---|---|---|---|
limit |
integer | no | Maximum number of log entries (default: 20) |
Returns recent error messages and notable events from the server log.
Example response:
{
"errors": [
{
"timestamp": "2024-01-15T10:23:45Z",
"level": "error",
"message": "MATLAB engine timeout on job abc123",
"job_id": "abc123"
}
],
"total_errors": 42
}Custom tools can be defined in your custom_tools.yaml configuration file and are dynamically registered at runtime. Custom tools follow the same conventions as built-in tools and can be called using the standard MCP tool interface. Refer to your custom_tools.yaml for the complete list of custom tools available in your deployment.