---
orphan: true
---

# Create MCP tools in batches

Batch create tools from probed or saved MCP connections as workspace tools.

```text
POST https://moi.matrixorigin.cn/newmoi/workspaces/{workspace_id}/connections/actions/batch-create-mcp-tools
```

## Before you call

The examples below use `$AI_STUDIO_API_KEY`, `$WORKSPACE_ID`, and `$CONNECTION_ID`.

## Request example

```bash
curl -X POST "https://moi.matrixorigin.cn/newmoi/workspaces/$WORKSPACE_ID/connections/actions/batch-create-mcp-tools" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H 'Content-Type: application/json' \
  -d '{
    "connection_id": "'"$CONNECTION_ID"'",
    "items": [
      {
        "tool_name": "search_docs",
        "name": "搜索文档"
      }
    ]
  }'
```

## Request body

| Parameters | Type | Is it required | Description |
| --- | --- | --- | --- |
| `connection_id` | string | No | The saved MCP connection ID. |
| `name` | string | No | The name of the new connection. |
| `endpoint_uri` | string | No | The MCP service address of the new connection. |
| `transport` | string | No | MCP transmission method. |
| `auth_type` | string | No | Authentication type. |
| `api_key_header` | string | No | The request header name used by API Key. |
| `credential` | object | No | MCP credentials. |
| `visibility` | string | No | The visible range of the new connection. |
| `items` | object[] | Yes | MCP tools to create. |
| `items[].tool_name` | string | Yes | The tool name for MCP service discovery. |
| `items[].name` | string | Yes | The name of the tool after creation. |
| `items[].description` | string | No | Tool description. |
| `items[].input_schema` | object | No | Tool input Schema. |
| `items[].output_schema` | object | No | Tool output Schema. |
| `items[].tags` | string[] | No | Tool label. |
| `items[].category` | string | No | Tool classification. |

`[]` after a type denotes an array. `[]` in a field path denotes each item in an array.

## Successful response

Returns `200` and the creation result on success.

```json
{"code":0,"data":{"items":[]}}
```

The response fields are as follows.

| Field | Type | Description |
| --- | --- | --- |
| `data.items` | array | Batch creation results. |

`[]` after a type denotes an array. `[]` in a field path denotes each item in an array.

## Error response

```json
{"code":2,"message":"invalid request"}
```
