-
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.
Example response:
{
"status": "completed",
"output": " Name Size Bytes Class Attributes\n\n A 5x5 200 double\n B 1x10 80 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,
"estimated_remaining_seconds": 65.0
}Get the full result of a completed job.
| Parameter | Type | Required | Description |
|---|---|---|---|
job_id |
string | yes | Job ID |
Example response:
{
"status": "completed",
"output": "result =\n 42",
"execution_time": 245.5,
"variables": {
"result": "double"
}
}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 cancelled successfully"
}List all jobs in the current session.
| Parameter | Type | Required | Description |
|---|---|---|---|
| (none) | — | — | — |
Example response:
{
"session_id": "sess-001",
"jobs": [
{
"job_id": "abc123-def456",
"status": "completed",
"submitted_at": "2024-01-15T10:30:00Z",
"completed_at": "2024-01-15T10:35:45Z",
"execution_time": 345.5
},
{
"job_id": "xyz789-uvw012",
"status": "running",
"submitted_at": "2024-01-15T10:40:00Z",
"elapsed_seconds": 120.0
}
],
"total_jobs": 2
}List available MATLAB toolboxes.
| Parameter | Type | Required | Description |
|---|---|---|---|
| (none) | — | — | — |
Example response:
{
"status": "completed",
"output": "MATLAB Version 23.2.0.2459053 (R2023b) Update 5\n\nSignal Processing Toolbox Version 9.2 (R2023b)\nImage Processing Toolbox Version 11.8 (R2023b)\nStatistics and Machine Learning Toolbox Version 12.5 (R2023b)",
"toolboxes": [
"Signal Processing Toolbox",
"Image Processing Toolbox",
"Statistics and Machine Learning Toolbox"
]
}List functions in a specific toolbox.
| Parameter | Type | Required | Description |
|---|---|---|---|
toolbox_name |
string | yes | Name of the toolbox |
Example response:
{
"status": "completed",
"toolbox_name": "Signal Processing Toolbox",
"output": "Signal Processing Toolbox\n\n Filtering\n filter - 1-D digital filter\n filtfilt - Zero-phase digital filtering\n\n 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:
{
"status": "completed",
"function_name": "fft",
"output": "FFT 2-D fast Fourier transform.\n Y = FFT(X) computes the discrete Fourier transform of X using\n a fast Fourier transform algorithm.\n \n Y = FFT(X,N) pads X with zeros to length N before transforming."
}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:
{
"status": "success",
"filename": "data.csv",
"size_bytes": 1024,
"path": "/tmp/matlab_session_abc123/data.csv",
"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:
{
"status": "success",
"filename": "data.csv",
"message": "File deleted successfully"
}List files in the session's temporary directory.
| Parameter | Type | Required | Description |
|---|---|---|---|
| (none) | — | — | — |
Example response:
{
"status": "completed",
"session_temp_dir": "/tmp/matlab_session_abc123",
"files": [
{
"name": "data.csv",
"size_bytes": 1024,
"path": "/tmp/matlab_session_abc123/data.csv"
},
{
"name": "script.m",
"size_bytes": 2048,
"path": "/tmp/matlab_session_abc123/script.m"
}
],
"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 script file |
Example response:
{
"status": "success",
"filename": "script.m",
"content": "function result = calculate(x)\n % Calculate the square\n result = x .^ 2;\nend"
}Read a data file (.mat, .csv, .json, .txt, .xlsx) from the session's temporary directory.
| Parameter | Type | Required | Description |
|---|---|---|---|
filename |
string | yes | Name of the data file |
format |
string | no |
summary (default) or raw for .mat files; ignored for text files |
Example response (summary mode for .mat):
{
"status": "success",
"filename": "workspace.mat",
"format": "summary",
"variables": [
{
"name": "A",
"size": "5x5",
"type": "double",
"bytes": 200
},
{
"name": "B",
"size": "1x10",
"type": "double",
"bytes": 80
}
]
}Example response (text file):
{
"status": "success",
"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's temporary directory.
| Parameter | Type | Required | Description |
|---|---|---|---|
filename |
string | yes | Name of the image file |
Returns: An inline image content block that renders in agent UIs. The image data is base64-encoded and included with appropriate MIME type metadata.
Get the current status of the MATLAB engine pool.
| Parameter | Type | Required | Description |
|---|---|---|---|
| (none) | — | — | — |
Example response:
{
"status": "healthy",
"total_engines": 4,
"available_engines": 2,
"busy_engines": 2,
"max_engines": 8,
"utilization_percent": 50.0
}Get comprehensive server metrics including pool, jobs, sessions, and system stats.
| Parameter | Type | Required | Description |
|---|---|---|---|
| (none) | — | — | — |
Example response:
{
"timestamp": "2024-01-15T10:45:30Z",
"pool_metrics": {
"total_engines": 4,
"available_engines": 2,
"busy_engines": 2,
"max_engines": 8,
"utilization_percent": 50.0
},
"job_metrics": {
"total_jobs": 42,
"completed_jobs": 38,
"running_jobs": 3,
"failed_jobs": 1
},
"session_metrics": {
"active_sessions": 5,
"total_sessions": 15
},
"system_metrics": {
"cpu_percent": 35.2,
"memory_percent": 62.1,
"uptime_seconds": 86400
}
}Get server health status with issue detection.
| Parameter | Type | Required | Description |
|---|---|---|---|
| (none) | — | — | — |
Example response:
{
"status": "healthy",
"message": "All systems operational",
"checks": {
"pool_health": "ok",
"job_queue": "ok",
"memory_usage": "ok",
"session_count": "ok"
},
"issues": []
}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:
{
"status": "completed",
"entries": [
{
"timestamp": "2024-01-15T10:30:15Z",
"level": "error",
"source": "job_executor",
"message": "MATLAB execution failed: Undefined variable 'x'"
},
{
"timestamp": "2024-01-15T10:25:42Z",
"level": "warning",
"source": "pool_manager",
"message": "Engine timeout detected, restarting engine pool-2"
},
{
"timestamp": "2024-01-15T10:20:00Z",
"level": "info",
"source": "session_manager",
"message": "New session created: sess-001"
}
],
"total_entries": 3
}Custom tools can be registered via the custom_tools.yaml configuration file. Custom tools are dynamically loaded at server startup and are available alongside the 20 built-in tools. Each custom tool definition includes:
- name: The tool identifier
- description: Human-readable description
- parameters: Input schema (name, type, required, description)
- handler: The Python function or MATLAB code to execute
Custom tools are useful for domain-specific workflows, preprocessing/postprocessing, and integration with external systems. They follow the same async execution model as built-in tools and are fully tracked in the job management system.