-
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": "double (1x1)",
"y": "double (1x1)"
}
}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": "Undefined function or variable",
"severity": "error"
}
],
"summary": "1 warning(s), 1 error(s)"
}Get variables in the current MATLAB workspace.
| Parameter | Type | Required | Description |
|---|---|---|---|
| (none) | — | — | — |
Returns the output of MATLAB's whos command, showing variable names, sizes, and types.
Example response:
{
"output": " Name Size Bytes Class Attributes\n x 1x1 8 double\n y 1x100 800 double",
"variables": [
{
"name": "x",
"size": "1x1",
"bytes": 8,
"class": "double"
},
{
"name": "y",
"size": "1x100",
"bytes": 800,
"class": "double"
}
]
}Get status and progress of a running or completed job.
| Parameter | Type | Required | Description |
|---|---|---|---|
job_id |
string | yes | Job ID from execute_code
|
Example response (running):
{
"job_id": "abc123-def456",
"status": "running",
"progress": 65.0,
"message": "Trial 650000/1000000",
"elapsed_seconds": 120.5,
"estimated_remaining_seconds": 64.2
}Example response (completed):
{
"job_id": "abc123-def456",
"status": "completed",
"elapsed_seconds": 185.0,
"execution_time": 184.7
}Get the full result of a completed job.
| Parameter | Type | Required | Description |
|---|---|---|---|
job_id |
string | yes | Job ID |
Example response:
{
"status": "completed",
"output": "Result matrix: [1.23, 4.56; 7.89, 10.11]",
"variables": {
"result": "double (2x2)",
"timestamp": "datetime (1x1)"
},
"execution_time": 45.2
}Cancel a pending or running job.
| Parameter | Type | Required | Description |
|---|---|---|---|
job_id |
string | yes | Job ID |
Example response:
{
"job_id": "abc123-def456",
"status": "cancelled",
"message": "Job successfully cancelled"
}List all jobs in the current session.
| Parameter | Type | Required | Description |
|---|---|---|---|
| (none) | — | — | — |
Example response:
{
"jobs": [
{
"job_id": "abc123-def456",
"status": "completed",
"submitted_at": "2024-01-15T10:30:00Z",
"completed_at": "2024-01-15T10:30:45Z",
"execution_time": 45.2
},
{
"job_id": "xyz789-uvw012",
"status": "running",
"submitted_at": "2024-01-15T10:31:00Z",
"elapsed_seconds": 30.5
}
],
"total": 2
}List available MATLAB toolboxes (filtered by config).
| Parameter | Type | Required | Description |
|---|---|---|---|
| (none) | — | — | — |
Example response:
{
"toolboxes": [
{
"name": "MATLAB",
"version": "R2023b",
"release": "23.2"
},
{
"name": "Signal Processing Toolbox",
"version": "9.5"
},
{
"name": "Statistics and Machine Learning Toolbox",
"version": "12.4"
}
],
"total": 3
}List functions in a specific toolbox.
| Parameter | Type | Required | Description |
|---|---|---|---|
toolbox_name |
string | yes | Name of the toolbox |
Example response:
{
"toolbox_name": "Signal Processing Toolbox",
"functions": [
"fft",
"ifft",
"filter",
"butter",
"cheby1",
"freqz"
],
"output": "Signal Processing Toolbox\n\nFourier transforms...\n fft - Fast Fourier transform\n ifft - Inverse fast Fourier transform..."
}Get MATLAB help text for any function.
| Parameter | Type | Required | Description |
|---|---|---|---|
function_name |
string | yes | Name of the function |
Example response:
{
"function_name": "fft",
"help_text": "FFT Fast Fourier transform.\n FFT(X) is the discrete Fourier transform of vector X.\n For matrices, the FFT operation is applied to each column.\n FFT(X,N) pads or truncates the vector X to length N before...",
"source": "Signal Processing Toolbox"
}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 |
Example response:
{
"filename": "data.csv",
"path": "/tmp/session_abc123/data.csv",
"size_bytes": 2048,
"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",
"size_bytes": 2048,
"path": "/tmp/session_abc123/data.csv",
"modified_at": "2024-01-15T10:30:00Z"
},
{
"name": "results.mat",
"size_bytes": 5120,
"path": "/tmp/session_abc123/results.mat",
"modified_at": "2024-01-15T10:31:00Z"
}
],
"total_files": 2,
"total_size_bytes": 7168
}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": "% My MATLAB script\nx = 1:100;\ny = sin(x);\nplot(x, y);\ntitle('Sine Wave');"
}Read a data file (.mat, .csv, .json, .txt, .xlsx) from the session temporary directory.
| Parameter | Type | Required | Description |
|---|---|---|---|
filename |
string | yes | Name of the file to read |
format |
string | no |
summary (default) or raw. For .mat files: summary shows variable metadata; raw returns base64. Text files return inline. |
Example response (summary format for .mat):
{
"filename": "results.mat",
"format": "summary",
"variables": [
{
"name": "x",
"size": "1x1000",
"bytes": 8000,
"type": "double"
},
{
"name": "y",
"size": "1x1000",
"bytes": 8000,
"type": "double"
}
]
}Example response (text file):
{
"filename": "data.csv",
"content": "x,y,z\n1,2,3\n4,5,6\n7,8,9"
}Read an image file (.png, .jpg, .gif) from the session temporary directory.
| Parameter | Type | Required | Description |
|---|---|---|---|
filename |
string | yes | Name of the image file to read |
Returns: An inline content block containing the image data that renders in agent UIs.
Example response:
{
"type": "image",
"data": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==",
"filename": "plot.png"
}Get the current status of the MATLAB engine pool.
| Parameter | Type | Required | Description |
|---|---|---|---|
| (none) | — | — | — |
Example response:
{
"total_engines": 4,
"available_engines": 3,
"busy_engines": 1,
"max_engines": 8,
"queue_length": 0
}Get comprehensive server metrics including pool, jobs, sessions, and system stats.
| Parameter | Type | Required | Description |
|---|---|---|---|
| (none) | — | — | — |
Example response:
{
"timestamp": "2024-01-15T10:30:00Z",
"pool": {
"total_engines": 4,
"available_engines": 3,
"busy_engines": 1,
"max_engines": 8
},
"jobs": {
"total": 42,
"completed": 38,
"running": 2,
"cancelled": 2,
"failed": 0
},
"sessions": {
"active": 5,
"total_created": 12
},
"system": {
"cpu_percent": 45.2,
"memory_percent": 62.1,
"uptime_seconds": 86400
}
}Get server health status with issue detection.
| Parameter | Type | Required | Description |
|---|---|---|---|
| (none) | — | — | — |
Example response (healthy):
{
"status": "healthy",
"message": "All systems operational",
"issues": []
}Example response (degraded):
{
"status": "degraded",
"message": "Some issues detected",
"issues": [
{
"component": "pool",
"severity": "warning",
"message": "Engine queue length is 5"
}
]
}Example response (unhealthy):
{
"status": "unhealthy",
"message": "Critical issues detected",
"issues": [
{
"component": "engines",
"severity": "critical",
"message": "No engines available"
},
{
"component": "memory",
"severity": "critical",
"message": "Memory usage at 95%"
}
]
}Get recent server errors and notable events for diagnosing issues.
| Parameter | Type | Required | Description |
|---|---|---|---|
limit |
integer | no | Maximum number of log entries to return (default: 20) |
Example response:
{
"errors": [
{
"timestamp": "2024-01-15T10:25:30Z",
"level": "error",
"component": "execution",
"message": "Job abc123 failed: Undefined function 'foo'"
},
{
"timestamp": "2024-01-15T10:20:15Z",
"level": "warning",
"component": "pool",
"message": "Engine exhausted, 3 jobs queued"
},
{
"timestamp": "2024-01-15T10:15:00Z",
"level": "info",
"component": "session",
"message": "Session xyz789 created"
}
],
"total": 3
}Custom tools can be configured via custom_tools.yaml and are dynamically registered at runtime. Each custom tool is exposed as an MCP tool with its own parameters and return type. Custom tools follow the same patterns as built-in tools and can be invoked using execute_code or through direct tool calls if they are registered as separate tools.
Refer to your custom_tools.yaml configuration file for the list and documentation of available custom tools in your deployment.