weread-skills

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

WeRead — 微信读书助手

WeRead — WeRead Assistant

通过 Agent API Gateway 调用微信读书接口,提供搜索、书架、笔记、书评等能力。
Call WeRead interfaces via Agent API Gateway, providing capabilities such as search, bookshelf management, notes, book reviews, etc.

支持的能力

Supported Capabilities

能力说明用户示例详细说明
搜索书籍在书城搜索"帮我搜一下三体"
search.md
书籍信息查看书籍详情、章节目录、阅读进度"这本书有多少章" "我读到哪了"
book.md
书架管理查看书架"看看我的书架"
shelf.md
阅读统计阅读时长、天数、偏好分析、阅读统计摘要"我这个月读了多久" "今年读了几本书"
readdata.md
笔记划线查看个人笔记数量与内容,包括划线、想法/点评、书签数量"看看我在三体里的笔记" "导出我的划线" "在这本书有多少笔记"
notes.md
章节热门划线查看书籍/章节热门划线、划线热度及划线下想法"看看这章有什么热门划线" "这段话下面有什么想法"
notes.md
书籍点评查看书籍的公开点评"三体这本书有什么点评?" "看看推荐的点评"
review.md
推荐好书个性化推荐/相似推荐"给我推荐几本书"
discover.md
根据用户意图参考对应说明文件了解接口参数、回包结构和工作流。

CapabilityDescriptionUser ExampleDetailed Instructions
Search BooksSearch in the book store"Help me search for The Three-Body Problem"
search.md
Book InformationView book details, chapter catalog, reading progress"How many chapters does this book have?" "Where did I leave off reading?"
book.md
Bookshelf ManagementView bookshelf"Show me my bookshelf"
shelf.md
Reading StatisticsReading duration, days, preference analysis, reading statistics summary"How long did I read this month?" "How many books have I read this year?"
readdata.md
Notes & UnderlinesView personal note count and content, including underlines, thoughts/comments, bookmark count"Show me my notes in The Three-Body Problem" "Export my underlines" "How many notes do I have in this book?"
notes.md
Popular Underlines in ChaptersView popular underlines in books/chapters, underline popularity and thoughts under underlines"Show me the popular underlines in this chapter" "What thoughts are there under this passage?"
notes.md
Book ReviewsView public reviews of books"What are the reviews for The Three-Body Problem?" "Show me recommended reviews"
review.md
Recommend Good BooksPersonalized recommendations/similar recommendations"Recommend some books to me"
discover.md
Refer to the corresponding instruction documents according to user intent to understand interface parameters, response structure and workflow.

接口调用规范

Interface Calling Specifications

统一入口

Unified Entry

POST https://i.weread.qq.com/api/agent/gateway
POST https://i.weread.qq.com/api/agent/gateway

鉴权

Authentication

  • Header:
    Authorization: Bearer $WEREAD_API_KEY
  • WEREAD_API_KEY
    从环境变量获取,格式
    wrk-xxxxxxxx
  • 若未设置,提示用户:
    export WEREAD_API_KEY=<你的apikey>
  • API Key 绑定用户身份(vid),需要用户身份的接口会自动注入,无需手动传 vid
  • Header:
    Authorization: Bearer $WEREAD_API_KEY
  • WEREAD_API_KEY
    is obtained from environment variables, in the format
    wrk-xxxxxxxx
  • If not set, prompt the user:
    export WEREAD_API_KEY=<your apikey>
  • API Key is bound to user identity (vid), interfaces requiring user identity will automatically inject it, no need to manually pass vid

请求格式

Request Format

  • Method:POST
  • Content-Type:application/json
  • Body:JSON,
    api_name
    指定接口,其余为接口参数,每次请求必须带
    skill_version
bash
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": "/store/search", "keyword": "三体", "count": 10, "skill_version": "1.0.3"}'
  • Method: POST
  • Content-Type: application/json
  • Body: JSON,
    api_name
    specifies the interface, others are interface parameters,
    skill_version
    must be included in each request
bash
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": "/store/search", "keyword": "三体", "count": 10, "skill_version": "1.0.3"}'

请求 few-shot

Request Few-Shot Examples

正确:业务参数平铺在 body 顶层。
json
{"api_name":"/user/notebooks","count":100,"skill_version":"1.0.5"}
正确:下一页继续平铺
lastSort
json
{"api_name":"/user/notebooks","count":100,"lastSort":1516907353,"skill_version":"1.0.5"}
错误:不要把业务参数包在
params
内。
json
{"api_name":"/user/notebooks","params":{"count":100,"lastSort":1516907353},"skill_version":"1.0.5"}
上面的错误写法会导致
count
lastSort
未被转发,后端按默认值返回第一页,看起来像分页失效。
Correct: Business parameters are placed at the top level of the body.
json
{"api_name":"/user/notebooks","count":100,"skill_version":"1.0.5"}
Correct: Continue to place
lastSort
at the top level for next page.
json
{"api_name":"/user/notebooks","count":100,"lastSort":1516907353,"skill_version":"1.0.5"}
Incorrect: Do not wrap business parameters in
params
.
json
{"api_name":"/user/notebooks","params":{"count":100,"lastSort":1516907353},"skill_version":"1.0.5"}
The incorrect writing above will cause
count
and
lastSort
not to be forwarded, and the backend will return the first page according to default values, making it seem like pagination is invalid.

响应格式

Response Format

  • JSON,回包经过字段裁剪,只返回核心字段
  • errcode
    非 0 时表示错误,给出中文提示
  • 发送
    {"api_name": "/_list"}
    可查看所有可用接口及参数定义
  • JSON, the response is field-trimmed, only core fields are returned
  • Non-zero
    errcode
    indicates an error, with Chinese prompt message
  • Send
    {"api_name": "/_list"}
    to view all available interfaces and parameter definitions

通用规则

General Rules

  1. 版本上报:每次请求 body 必须包含
    "skill_version": "1.0.3"
    (取本文件顶部 version 字段的值),用于服务端检查版本更新。如果回包中出现
    upgrade_info
    字段,必须立即暂停当前操作,按照
    upgrade_info.message
    中的指引完成升级,升级完成后再重新执行用户请求,不得忽略该字段
  2. 参数平铺:业务参数必须和
    api_name
    skill_version
    放在同一层;不要包在
    params
    data
    body
    等对象里。只有接口文档明确声明的数组/对象字段(如
    /book/readreviews
    reviews
    )才允许作为业务字段传入。
  3. 能力文档预检:调用任何接口前,必须先根据「支持的能力」表阅读对应说明文件(如阅读统计先读
    readdata.md
    ,书架先读
    shelf.md
    ),确认接口参数、字段含义、单位、计数口径和工作流;禁止仅凭字段名或经验猜测含义。
  4. 字段解释优先级:解释接口回包时,以对应说明文件中的字段说明为准;如果回包字段名和直觉含义冲突,必须服从说明文件,不得直接翻译字段名。
  5. bookId 解析:用户输入书名时,先调
    /store/search
    获取 bookId,再执行后续操作
  6. 书架数量:使用
    /shelf/sync
    回答“书架有多少本书/多少条目”时,必须按
    books.length + albums.length + (mp 非空 ? 1 : 0)
    计算;
    albums[]
    是专辑/有声书,也属于书架里的书,详细规则见
    shelf.md
  7. 结果展示:列表用编号展示方便选择;搜索结果重点展示书名、作者、评分;展示接口回包信息时,字段禁止直接翻译,应该参考文件中的说明内容提供
  8. 上下文衔接:对话中记住已查询的 bookId,后续操作无需用户重复提供
  9. 深度链接:在展示划线、想法、章节等内容时,拼接对应的跳转链接方便用户直接在 App 中打开,具体格式见下方「深度链接(URL Schema)」章节
  10. 数据展示规范
  • 时间戳:所有 Unix 时间戳字段(如
    updateTime
    createTime
    finishTime
    readUpdateTime
    等),展示时须转为 YYYY-MM-DD 格式(如
    1748563200
    展示为"2025-05-30"),不得直接展示原始数字
  • 阅读时长:单位为秒,展示时转为"X小时Y分钟"格式

  1. Version Reporting: Each request body must include
    "skill_version": "1.0.3"
    (take the value of the version field at the top of this file), which is used for the server to check for version updates. If the
    upgrade_info
    field appears in the response, you must immediately pause the current operation, complete the upgrade according to the guidelines in
    upgrade_info.message
    , and re-execute the user request after the upgrade is completed; do not ignore this field
  2. Parameter Flattening: Business parameters must be placed at the same level as
    api_name
    and
    skill_version
    ; do not wrap them in objects like
    params
    ,
    data
    , or
    body
    . Only array/object fields explicitly declared in the interface documentation (such as
    reviews
    of
    /book/readreviews
    ) are allowed to be passed as business fields.
  3. Pre-check Capability Documentation: Before calling any interface, you must first read the corresponding instruction document according to the "Supported Capabilities" table (e.g., read
    readdata.md
    first for reading statistics,
    shelf.md
    first for bookshelf), confirm interface parameters, field meanings, units, counting calibers and workflows; it is forbidden to guess meanings solely based on field names or experience.
  4. Field Interpretation Priority: When interpreting interface responses, take the field descriptions in the corresponding instruction documents as the standard; if the response field name conflicts with intuitive meaning, you must follow the instruction document and not directly translate the field name.
  5. bookId Parsing: When the user enters a book title, first call
    /store/search
    to obtain the bookId, then perform subsequent operations
  6. Bookshelf Count: When using
    /shelf/sync
    to answer "How many books/items are in the bookshelf?", you must calculate it as
    books.length + albums.length + (mp is not null ? 1 : 0)
    ;
    albums[]
    are albums/audiobooks, which also belong to the books in the bookshelf, detailed rules can be found in
    shelf.md
  7. Result Display: Use numbered lists for display to facilitate selection; focus on displaying book title, author, and rating for search results; when displaying interface response information, forbid direct translation of fields, and should provide content based on the descriptions in the documents
  8. Context Cohesion: Remember the queried bookId in the conversation, and users do not need to provide it repeatedly for subsequent operations
  9. Deep Linking: When displaying underlines, thoughts, chapters and other content, splice the corresponding jump links to facilitate users to open the corresponding location directly in the App. For thoughts/reviews, not all have underline positions, only when
    chapterUid
    and
    range
    are available, generate the underline position link
  10. Data Display Specifications:
    • Timestamp: All Unix timestamp fields (such as
      updateTime
      ,
      createTime
      ,
      finishTime
      ,
      readUpdateTime
      , etc.) must be converted to YYYY-MM-DD format when displayed (e.g.,
      1748563200
      is displayed as "2025-05-30"), raw numbers cannot be displayed directly
    • Reading Duration: Unit is seconds, convert to "X hours Y minutes" format when displayed

深度链接(URL Schema)

Deep Linking (URL Schema)

在展示书籍、章节、划线等内容时,如果回包字段足以构造链接,应附上对应的跳转链接,方便用户点击后直接在微信读书 App 中打开对应位置。想法/点评不一定都有划线位置,只有具备
chapterUid
range
时才生成划线位置链接。
When displaying books, chapters, underlines and other content, if the response fields are sufficient to construct a link, attach the corresponding jump link to facilitate users to open the corresponding location directly in the WeRead App. Thoughts/reviews do not necessarily have underline positions, only when
chapterUid
and
range
are available, generate the underline position link.

打开书籍(跳转到上次阅读进度)

Open Book (Jump to last reading progress)

weread://reading?bId={bookId}
参数说明来源
bookId
书籍 ID各接口返回的
bookId
示例
weread://reading?bId=3300045871
使用场景
  • 展示书架列表时,每本书附上跳转链接
  • 展示搜索结果时,附上「打开阅读」链接
  • 展示阅读进度时,提供「继续阅读」链接
weread://reading?bId={bookId}
ParameterDescriptionSource
bookId
Book ID
bookId
returned by each interface
Example:
weread://reading?bId=3300045871
Usage Scenarios:
  • Attach a jump link to each book when displaying the bookshelf list
  • Attach an "Open to Read" link when displaying search results
  • Provide a "Continue Reading" link when displaying reading progress

跳转到指定章节

Jump to Specified Chapter

weread://reading?bId={bookId}&chapterUid={chapterUid}
参数说明来源
bookId
书籍 ID各接口返回的
bookId
chapterUid
章节 UID
/book/chapterinfo
返回的
chapters[].chapterUid
示例
weread://reading?bId=3300045871&chapterUid=107
使用场景
  • 展示章节目录时,每个章节附上跳转链接
weread://reading?bId={bookId}&chapterUid={chapterUid}
ParameterDescriptionSource
bookId
Book ID
bookId
returned by each interface
chapterUid
Chapter UID
chapters[].chapterUid
returned by
/book/chapterinfo
Example:
weread://reading?bId=3300045871&chapterUid=107
Usage Scenarios:
  • Attach a jump link to each chapter when displaying the chapter catalog

跳转到划线/想法所在位置

Jump to Underline/Thought Location

weread://bestbookmark?bookId={bookId}&chapterUid={chapterUid}&rangeStart={rangeStart}&rangeEnd={rangeEnd}&userVid={userVid}
参数说明来源
bookId
书籍 ID各接口返回的
bookId
chapterUid
章节 UID划线/想法所属的
chapterUid
rangeStart
划线起始位置
range
字段中
-
前面的数字
rangeEnd
划线结束位置
range
字段中
-
后面的数字
userVid
用户 VIDAPI Key 鉴权后自动关联的用户 ID(从
/shelf/sync
等接口的上下文获取,或省略)
range 解析:划线接口返回的
range
格式为
"起始-结束"
(如
"900-2004"
),拆分后分别填入
rangeStart
rangeEnd
示例
weread://bestbookmark?bookId=3300045871&chapterUid=107&rangeStart=900&rangeEnd=2004&userVid=583802764
使用场景
  • 展示划线列表(
    /book/bookmarklist
    )时,每条划线附上跳转链接(
    range
    字段可直接解析)
  • 展示热门划线(
    /book/bestbookmarks
    )时,每条附上跳转链接;
    /book/underlines
    只是划线热度统计,不含划线文本
  • 展示想法(
    /review/list/mine
    /book/readreviews
    )时,只有返回内容包含
    chapterUid
    range
    时才附上跳转到对应划线位置的链接;整本书评或无法定位到划线的点评不强制生成该链接
weread://bestbookmark?bookId={bookId}&chapterUid={chapterUid}&rangeStart={rangeStart}&rangeEnd={rangeEnd}&userVid={userVid}
ParameterDescriptionSource
bookId
Book ID
bookId
returned by each interface
chapterUid
Chapter UID
chapterUid
belonging to the underline/thought
rangeStart
Underline start positionThe number before
-
in the
range
field
rangeEnd
Underline end positionThe number after
-
in the
range
field
userVid
User VIDUser ID automatically associated after API Key authentication (obtained from the context of interfaces like
/shelf/sync
, or omitted)
range Parsing: The
range
field returned by the underline interface is in the format
"start-end"
(e.g.,
"900-2004"
), split it and fill in
rangeStart
and
rangeEnd
respectively.
Example:
weread://bestbookmark?bookId=3300045871&chapterUid=107&rangeStart=900&rangeEnd=2004&userVid=583802764
Usage Scenarios:
  • Attach a jump link to each underline when displaying the underline list (
    /book/bookmarklist
    ) (the
    range
    field can be directly parsed)
  • Attach a jump link to each when displaying popular underlines (
    /book/bestbookmarks
    );
    /book/underlines
    is only underline popularity statistics and does not contain underline text
  • When displaying thoughts (
    /review/list/mine
    ,
    /book/readreviews
    ), only attach the link to jump to the corresponding underline position if the returned content includes
    chapterUid
    and
    range
    ; reviews for the entire book or reviews that cannot be located to an underline do not require generating this link