<span id="搜索插件能力"></span>

# Search plugin capabilities

```{raw} html
<div class="mo-api-page-show-toc" aria-hidden="true"></div>
```

Search capabilities from installed or installable plugins.

```text
GET https://api.moi.matrixorigin.cn/v5/workspaces/{workspace_id}/plugin-discovery/search
```

<span id="调用前准备"></span>

## Before you call this API

Prepare the target Workspace ID and a personal access token that can access the resources and perform this operation. Use the actual resource identifier for `workspace_id` in the path, and also supply the Workspace ID in `X-Workspace-ID`. See [Shared objects and inputs](objects.md#input-identifiers) for environment variable sources.

<span id="查询参数"></span>

## Query parameters

:::::::{div} mo-api-tabs
::::::{tab-set}
:::::{tab-item} Request example

```bash
curl -X GET "https://api.moi.matrixorigin.cn/v5/workspaces/$WORKSPACE_ID/plugin-discovery/search" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  --get \
  --data-urlencode "q=$PLUGIN_QUERY" \
  --data-urlencode "availability=all" \
  --data-urlencode "limit=5"
```

Only when `has_more=true`, set `$NEXT_CURSOR` to the returned next_cursor and continue.

```bash
curl -X GET "https://api.moi.matrixorigin.cn/v5/workspaces/$WORKSPACE_ID/plugin-discovery/search" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  --get \
  --data-urlencode "q=$PLUGIN_QUERY" \
  --data-urlencode "availability=all" \
  --data-urlencode "limit=5" \
  --data-urlencode "cursor=$NEXT_CURSOR"
```

:::::
:::::{tab-item} Parameters

Continue using has_more and next_cursor. Fewer candidates than limit do not establish completion. capabilities_truncated means one candidate's capability set is incomplete. capability_ref is the full reference used for description/skill reads and may become invalid after installation version or release digest changes.

| Fields | Type | Required | Description |
| --- | --- | --- | --- |
| `q` | string | No | Query text, up to 128 bytes, without surrounding whitespace. |
| `availability` | string | No | all (default), installed, or market. |
| `limit` | integer | No | 1–5 candidates per page; default 5. |
| `cursor` | string | No | Previous next_cursor; pass unchanged without parsing or inventing it. |

:::::
::::::
:::::::

<span id="成功响应"></span>

## Successful response

:::::::{div} mo-api-tabs mo-api-response-tabs
::::::{tab-set}
:::::{tab-item} Response example

```json
{
  "code": 0,
  "data": {
    "candidates": [],
    "has_more": false
  }
}
```

:::::
:::::{tab-item} Fields

| Field | Type | Description |
| --- | --- | --- |
| `code` | integer | 0 on success. |
| `data` | object | Data returned by this operation. |
| `data.candidates` | array | Resource fields; see [Shared objects and states](objects.md). |
| `data.has_more` | boolean | Whether another page exists. |

:::::
::::::
:::::::

<span id="错误响应"></span>

## Error response

Handle numeric business-error `code`, `message`, and `details.reason` separately from authorization-layer string codes. See [Errors and states](objects.md#error-responses). On a state or version conflict, read the current resource first; do not automatically change identifiers or retry writes.
