# Search practice parts

Search up to six compact IELTS Buddy question-bank candidates by subject, text, difficulty, exact tag ids, or literal tagQueries. Each result includes partId and a stable question_part contentRef. Source claims come only from origin fields; the server returns facts and the local Agent chooses the question.

- Capability ID: `practice.search_parts`
- Operation: `ielts_practice_search_parts`
- Category: 题库与练习
- Endpoint: `POST /api/v1/agent/capabilities/ielts_practice_search_parts`
- Authentication: Bearer Token（通过 /api/v1/agent-bindings 绑定账号）
- Required scopes: question_bank:read
- Side effect: read
- Human documentation: https://ieltsbuddy.igopx.cn/developers/api/ielts_practice_search_parts

## Request parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `cursor` | string | 否 | Cursor returned by the previous practice.search_parts call. |
| `difficulty` | string | 否 | Practice difficulty filter. |
| `excludePartIds` | number[] | 否 | Part ids the local Agent has ruled out for this selection. |
| `includeCourseLinked` | boolean | 否 | Whether to include course-linked parts. |
| `limit` | number | 否 | Result limit, 1-6. |
| `preferUnseen` | boolean | 否 | Whether the caller explicitly wants unseen parts before previously attempted parts. |
| `search` | string | 否 | Optional free-text title search. |
| `sort` | string | 否 | Catalog order or latest-first order chosen by the caller. |
| `subject` | string | 否 | Practice subject. |
| `tagIds` | number[] | 否 | Exact taxonomy tag ids resolved by practice.list_taxonomy. |
| `tagQueries` | unknown[] | 否 | Literal user-mentioned taxonomy terms. The Tool resolves them to exact tag ids before filtering. |

## Request example

```bash
curl -X POST \
  'https://work.ieltsbuddy.igopx.cn/api/v1/agent/capabilities/ielts_practice_search_parts' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer $IELTS_BUDDY_TOKEN' \
  --data '{"cursor":"","difficulty":"","excludePartIds":[],"includeCourseLinked":false,"limit":6,"preferUnseen":false,"search":"","sort":"catalog","subject":"","tagIds":[],"tagQueries":[]}'
```

## Request schema

```json
{
  "type": "object",
  "properties": {
    "cursor": {
      "default": "",
      "description": "Cursor returned by the previous practice.search_parts call.",
      "type": "string"
    },
    "difficulty": {
      "default": "",
      "description": "Practice difficulty filter.",
      "type": "string",
      "enum": [
        "",
        "基础",
        "核心",
        "冲刺"
      ]
    },
    "excludePartIds": {
      "default": [],
      "description": "Part ids the local Agent has ruled out for this selection.",
      "maxItems": 30,
      "type": "array",
      "items": {
        "type": "integer",
        "exclusiveMinimum": 0,
        "maximum": 9007199254740991
      }
    },
    "includeCourseLinked": {
      "default": false,
      "description": "Whether to include course-linked parts.",
      "type": "boolean"
    },
    "limit": {
      "default": 6,
      "description": "Result limit, 1-6.",
      "type": "integer",
      "minimum": 1,
      "maximum": 6
    },
    "preferUnseen": {
      "default": false,
      "description": "Whether the caller explicitly wants unseen parts before previously attempted parts.",
      "type": "boolean"
    },
    "search": {
      "default": "",
      "description": "Optional free-text title search.",
      "type": "string"
    },
    "sort": {
      "default": "catalog",
      "description": "Catalog order or latest-first order chosen by the caller.",
      "type": "string",
      "enum": [
        "catalog",
        "latest"
      ]
    },
    "subject": {
      "default": "",
      "description": "Practice subject.",
      "type": "string",
      "enum": [
        "",
        "listening",
        "reading",
        "speaking",
        "writing"
      ]
    },
    "tagIds": {
      "default": [],
      "description": "Exact taxonomy tag ids resolved by practice.list_taxonomy.",
      "maxItems": 12,
      "type": "array",
      "items": {
        "type": "integer",
        "exclusiveMinimum": 0,
        "maximum": 9007199254740991
      }
    },
    "tagQueries": {
      "default": [],
      "description": "Literal user-mentioned taxonomy terms. The Tool resolves them to exact tag ids before filtering.",
      "maxItems": 6,
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 80
      }
    }
  },
  "required": [
    "cursor",
    "difficulty",
    "excludePartIds",
    "includeCourseLinked",
    "limit",
    "preferUnseen",
    "search",
    "sort",
    "subject",
    "tagIds",
    "tagQueries"
  ],
  "additionalProperties": false
}
```

## Response envelope

```json
{
  "code": 0,
  "data": {},
  "message": "ok"
}
```

## Errors

| HTTP | Code | Meaning |
| --- | --- | --- |
| 400 | `40001` | 请求参数不符合接口契约 |
| 401 | `40101` | 缺少或使用了无效的访问令牌 |
| 403 | `40301` | 访问令牌不包含接口所需权限 |
| 404 | `40401` | 接口或目标资源不存在 |
