Create tool

Create a platform tool in the current workspace. After successful creation, the tool definition and its current bindable status are returned.

HTTP
POST $CLOUDSIGMA_API_BASE/workspaces/{workspace_id}/tools

Before you call

Configure the CloudSigma regional endpoint and authentication before calling. The endpoint, credentials, workspace, and resource IDs must belong to the same region. Prepare a personal access token and target workspace ID that can access the target workspace.

Request body

Shell
curl -X POST "$CLOUDSIGMA_API_BASE/workspaces/$WORKSPACE_ID/tools" \
  -H "X-API-Key: $CLOUDSIGMA_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "查询工具",
    "kind": "http_api",
    "side_effect_class": "read"
  }'

Parameter

Type

Required

Description

workspace_id

string

Yes

Current workspace ID.

id

string

No

Custom tool identifier. Generated by the server when omitted or empty string.

name

string

Yes

Tool name.

description

string

No

Tool description and display classification.

status

string

No

Tool description and display classification.

kind

string

Yes

Tool type: system, http_api, operator, market or code. MCP tools are created through the batch registration interface.

category

string

No

Tool description and display classification.

icon_ref

string

No

Tool description and display classification.

tags

array of string

No

Tool description and display classification.

phase

string

No

Tool description and display classification.

market_metadata

object

No

A marketplace of tools to display and distribute metadata.

source_ref

object

No

Tool source. Can include type, id, uri, version and config.

input_schema

object

No

Input and output JSON Schema.

output_schema

object

No

Input and output JSON Schema.

side_effect_class

string

Yes

Side effect classification: read, write or external_effect.

credential_ref

string

No

Credentials, approvals, and desensitization policy references.

approval_policy_ref

string

No

Credentials, approvals, and desensitization policy references.

redaction_policy_ref

string

No

Credentials, approvals, and desensitization policy references.

sync

object

No

Synchronization status, which can include status, last_sync_at and last_sync_error.

labels

object

No

Extended tags, annotations and metadata.

annotations

object

No

Extended tags, annotations and metadata.

metadata

object

No

Extended tags, annotations and metadata.

labels and annotations require a JSON object whose value can only be a string or null.

Successful response

JSON
{
  "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",
    "display_name": "示例工具",
    "source_ref": {},
    "sync": {}
  }
}

Field

Type

Description

code

integer

0 on success.

data

object

The result of this request.

data.id

string

Tool ID.

data.workspace_id

string

The identity of the workspace to which it belongs.

data.name

string

Name.

data.description

string

Description. Can be omitted if empty or not set.

data.display_name

string

Display name.

data.display_description

string

Show instructions. Can be omitted if empty or not set.

data.status

string

status. Preferable draft, active, disabled, archived

data.kind

string

Tool type. Preferable system, mcp, http_api, operator, market, code

data.category

string

classification. Can be omitted if empty or not set.

data.icon_ref

string

Icon reference. Can be omitted if empty or not set.

data.tags

array

label. Can be omitted if empty or not set.

data.phase

string

use stage. Can be omitted if empty or not set.

data.market_metadata

object

Market metadata. Can be omitted if empty or not set.

data.source_ref

object

An empty object is returned when the source information has no subfields.

data.source_ref.type

string

Source type. Can be omitted if empty or not set.

data.source_ref.id

string

Source object ID, the specific type is specified by source_ref.type. Can be omitted if empty or not set.

data.source_ref.uri

string

Source address. Can be omitted if empty or not set.

data.source_ref.version

string

Version number. Can be omitted if empty or not set.

data.source_ref.config

object

Resource allocation. Can be omitted if empty or not set.

data.input_schema

object

Tool input JSON Schema. Can be omitted if empty or not set.

data.output_schema

object

The tool outputs JSON Schema. Can be omitted if empty or not set.

data.side_effect_class

string

Classification of side effects. Preferable read, write, external_effect

data.credential_ref

string

Credentials reference. Can be omitted if empty or not set.

data.approval_policy_ref

string

Approval policy reference. Can be omitted if empty or not set.

data.redaction_policy_ref

string

Desensitization strategies cited. Can be omitted if empty or not set.

data.sync

object

An empty object is returned when the synchronization information has no subfields.

data.sync.status

string

status. Can be omitted if empty or not set.

data.sync.last_sync_at

string or null

Last sync time. Can be omitted if empty or not set.

data.sync.last_sync_error

string

Recent sync errors. Can be omitted if empty or not set.

data.version

integer

Version number.

data.labels

object

Extension tag. Can be omitted if empty or not set.

data.annotations

object

Extended comments. Can be omitted if empty or not set.

data.metadata

object

Extended metadata. Can be omitted if empty or not set.

data.bindable

boolean

Whether it can be bound.

data.bindability_reason

string

Description of binding capabilities. Can be omitted if empty or not set.

data.supported_runtimes

array

Supported runtimes. Can be omitted if empty or not set.

data.created_by

string

Creator ID. Can be omitted if empty or not set.

data.updated_by

string

Last updated by identifier. Can be omitted if empty or not set.

data.created_at

string

Creation time. Use RFC 3339 format.

data.updated_at

string

Last updated time. Use RFC 3339 format.

Error response

JSON
{
  "code": 2,
  "message": "<错误信息>"
}

Common HTTP errors

HTTP status code

error code

Description

400

2(INVALID_ARGUMENT)

Common causes: The request body, tool definition, or credential reference is invalid. Recommended Action: Check the field value and associated resources.

401

6(UNAUTHENTICATED)

Common Cause: Valid identity credentials are missing. Recommended Action: Check the API Key.

403

5(PERMISSION_DENIED)

Common reasons: The current identity does not have the permission to create tools in the workspace. Recommended Action: Check the workspace authorization.

409

4(ALREADY_EXISTS)

Common Cause: The tool ID or tool definition already exists. Recommended Action: Change the tool ID or check the existing tool.

503

15(UNAVAILABLE)

Common reasons: Tool resource services or authorization dependencies are temporarily unavailable. Recommended Action: Try again later.

Last updated on