Skip to content

[Bug] /book/similar 文档中 count/maxIdx 标为 optional,实际不传会返回 -2003 参数格式错误 #1

@CoinkWang

Description

@CoinkWang

问题

discover.md/book/similar 接口的参数表把 countmaxIdx 都标为 可选

| count | int | 否 | 每页数量,默认 12 |
| maxIdx | int | 否 | 翻页偏移,默认 0 |

但实际调用时,这两个字段必须同时显式存在于 body 顶层,缺任意一个网关都会返回:

{"errcode": -2003, "errlog": "...", "errmsg": "参数格式错误"}

跟另一个推荐接口 /book/recommend(同文件,同样把 count/maxIdx 标 optional)行为不一致——/book/recommend 不传是真 OK 的。

复现

skill_version: 1.0.3,固定 bookId=178677(三体1)做参数矩阵测试:

bookId count maxIdx 结果
-2003 参数格式错误
10 -2003 参数格式错误
0 -2003 参数格式错误
10 0 ✅ 返回 10 本推荐
0 0 ✅ 返回 0 本(说明 0 是合法值)

最小失败请求:

curl -X POST "https://i.weread.qq.com/api/agent/gateway" \
  -H "Authorization: Bearer $WEREAD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"api_name":"/book/similar","bookId":"178677","skill_version":"1.0.3"}'
# {"errcode":-2003,"errlog":"...","errmsg":"参数格式错误"}

最小成功请求(补齐 count + maxIdx):

curl -X POST "https://i.weread.qq.com/api/agent/gateway" \
  -H "Authorization: Bearer $WEREAD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"api_name":"/book/similar","bookId":"178677","count":10,"maxIdx":0,"skill_version":"1.0.3"}'

count=0 也能通过校验(返回空),说明服务端是做的字段存在性校验,而不是值合法性校验。

bookId=812443(白鹿原)/ bookId=695233(三体全集)行为一致,跟书是否合集、是否读完无关。

影响

按文档"可选"调用 /book/similar 的实现一律失败,看起来像"接口挂了",但其实是文档/网关任一侧的一致性问题。

环境

  • skill 版本:1.0.3(npx skills add Tencent/WeChatReading -g 装的)
  • 调用方:Claude Code / Claude Desktop(bash + curl)
  • 测试时间:2026-05-26

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions