Import Workspace MCP tools¶
The tool-level entry point saves tool metadata only.
POST https://api.moi.matrixorigin.cn/v5/workspaces/{workspace_id}/tools/actions/import-workspace-mcp
Before you call this API¶
Obtain a personal access token and workspace ID for the current environment as described in AI Studio. The current effective role must permit the action.
Request parameters¶
curl -X POST "https://api.moi.matrixorigin.cn/v5/workspaces/$WORKSPACE_ID/tools/actions/import-workspace-mcp" \
-H "X-API-Key: $AI_STUDIO_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H "Content-Type: application/json" \
--data '{"dry_run":true,"tool_names":["qa_echo"]}'
Parameter |
Type |
Required |
Description |
|---|---|---|---|
|
string |
Yes |
Target workspace ID in the current environment, matching the header. |
|
string |
Yes |
Workspace ID in the current environment. |
|
string |
Yes |
Personal access token in the current environment. |
|
boolean |
No |
JSON request body. true performs a dry run only; omission, null, or false performs the import. |
|
string (array of strings) |
No |
JSON request body. Choose exact names returned by the dry run. Omission, null, or [] selects all candidates. |
|
object (array of objects) |
No |
Additional descriptors. Omit for ordinary tasks; see the shared contract for subfields. |
Explicitly send dry_run=true first, choose importable names from the result, and explicitly supply tool_names for the actual call. Dry runs may include nonimportable product_api tools; do not write the entire dry-run result back directly. See Import contract for filtering, descriptors, and partial writes. This entry point does not automatically bind agents.
Successful response¶
{
"code": 0,
"data": {
"dry_run": true,
"tools": [
{
"name": "qa_echo",
"kind": "operator",
"origin": "api_service"
}
]
}
}
Field |
Type |
Description |
|---|---|---|
|
integer |
0 on success. |
|
boolean |
Whether this request is a dry run. |
|
object (array of objects) |
Selected import results; may be empty when nothing matches. |
|
string |
Candidate tool name. |
|
string |
Description returned when nonempty. |
|
string |
Currently projected as operator. |
|
string |
Optional identifier. New API services currently bind by name, so this is not guaranteed. |
|
string |
Optional identifier; unpopulated in the current name-binding branch. |
|
string |
Optional version. Current API services do not pin node versions. |
|
string |
Returned only when the corresponding source value exists; not ordinary client import input. |
|
string |
Existing or actually created tool ID; may be omitted for new candidates during a dry run. |
|
string |
Source, such as api_service or product_api. Product API supports dry runs only and cannot actually be imported as an agent tool. |
|
boolean |
true when reusing a same-name tool; false may be omitted and does not establish equality of all configuration. |
Error responses¶
HTTP / code |
Conditions and handling |
|---|---|
400 / 2 |
Invalid parameters, candidate, or target state. Actual selections containing product_api are rejected before creation. |
403 / 5 |
Current operation is unauthorized or the tool is read-only. |
409 / 4、9 |
Tool name or update-version conflict. Read back the existing tool first. |
503 / 15 |
Workspace MCP import or authorization dependencies are unavailable. |
The authentication stage may also return string code/msg. See errors and environments.