Create tool¶
Creates a platform tool in the current workspace. After successful creation, the tool definition and its current bindable status are returned.
POST https://moi.matrixorigin.cn/newmoi/workspaces/{workspace_id}/tools
Before you call¶
Prepare a personal access token and target workspace ID that has access to the target workspace.
The example below uses:
$AI_STUDIO_API_KEY: The actual personal access token, passed through theX-API-KeyHeader.$WORKSPACE_ID: The workspace ID of the tool to be created, passed through theX-Workspace-IDHeader.
Request example¶
curl -X POST "https://moi.matrixorigin.cn/newmoi/workspaces/$WORKSPACE_ID/tools" \
-H "X-API-Key: $AI_STUDIO_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H 'Content-Type: application/json' \
-d '{
"name": "查询工具",
"kind": "http_api",
"side_effect_class": "read"
}'
Path parameters¶
Parameters |
Type |
Is it required |
Description |
|---|---|---|---|
|
string |
Yes |
The current workspace ID. |
Request body¶
Field |
Type |
Is it required |
Description |
|---|---|---|---|
|
string |
Yes |
Tool name. |
|
string |
No |
Tool description and display classification. |
|
string |
No |
Tool description and display classification. |
|
string |
No |
Tool description and display classification. |
|
string |
No |
Tool description and display classification. |
|
string |
No |
Tool description and display classification. |
|
string[] |
No |
Tool description and display classification. |
|
string |
No |
Tool description and display classification. |
|
object |
No |
Tool market presentation and distribution metadata. |
|
object |
No |
Tool source; can include |
|
object |
No |
Input and output JSON Schema. |
|
object |
No |
Input and output JSON Schema. |
|
string |
No |
Side effect classification: |
|
string |
No |
Credentials, approvals, and masking policy references. |
|
string |
No |
Credentials, approvals, and masking policy references. |
|
string |
No |
Credentials, approvals, and masking policy references. |
|
object |
No |
Synchronization status, can include |
|
object |
No |
Extended tags, comments, and metadata. |
|
object |
No |
Extended tags, comments, and metadata. |
|
object |
No |
Extended tags, comments, and metadata. |
[] after a type denotes an array. [] in a field path denotes each item in an array.
Successful response¶
Returns 201 on success.
{
"code": 0,
"data": {
"id": "tool_01",
"workspace_id": "ws_01",
"name": "查询工具",
"status": "draft",
"kind": "http_api",
"side_effect_class": "read",
"version": 1,
"bindable": true,
"supported_runtimes": [],
"created_at": "2026-01-02T15:04:05Z",
"updated_at": "2026-01-02T15:04:05Z"
}
}
The response fields are as follows.
Field |
Type |
Description |
|---|---|---|
|
integer |
|
|
string |
Tool ID, workspace and name. |
|
string |
Tool ID, workspace and name. |
|
string |
Tool ID, workspace and name. |
|
string |
Tool status, category and side effect classification. |
|
string |
Tool status, category and side effect classification. |
|
string |
Tool status, category and side effect classification. |
|
object |
Source, input schema, and output schema; not returned if not set. |
|
object |
Source, input schema, and output schema; not returned if not set. |
|
object |
Source, input schema, and output schema; not returned if not set. |
|
integer |
Tool resource version. |
|
boolean |
Current binding capabilities, reasons for unbinding, and supported operating environments. |
|
string |
Current binding capabilities, reasons for unbinding, and supported operating environments. |
|
string[] |
Current binding capabilities, reasons for unbinding, and supported operating environments. |
|
string |
Creation and last update times, using RFC 3339 format. |
|
string |
Creation and last update times, using RFC 3339 format. |
[] after a type denotes an array. [] in a field path denotes each item in an array.
Error response¶
{
"code": 2,
"message": "<错误信息>"
}
Common HTTP errors¶
HTTP status code |
error code |
Common causes |
Recommended actions |
|---|---|---|---|
|
|
The request body, tool definition, or credential reference is invalid. |
Check field values and associated resources. |
|
|
Lack of valid identity credentials. |
Check API Key. |
|
|
The current identity does not have permission to create tools in the workspace. |
Check workspace authorization. |
|
|
The tool ID or tool definition already exists. |
Change tool ID or check existing tool. |
|
|
Tool resource services or authorization dependencies are temporarily unavailable. |
Try again later. |
Follow-up operations¶
After the creation is completed, Query tool details confirms the result.