用途:在对外部库的 API、配置或行为作出任何断言前,先通过 Context7 MCP 检索当前文档,而不是依赖训练数据记忆。适用于库 API 与配置问题、确认外部依赖的当前行为、版本升级前查阅迁移说明、调试“API 为何不工作”,以及编写 nixpkgs 派生(如 buildGoModule、rustPlatform.buildRustPackage 及其 hash 属性)时对照 /nixos/nixpkgs。
主要能力:提供两个工具。resolve-library-id 将库名转换为 Context7 ID;query-docs 针对特定主题抓取文档。已知 ID 时可跳过解析步骤。资料列出的已知 ID 包括 /microsoft/typescript、/nixos/nixpkgs、/nix-community/home-manager、/golang/website、/golang/tools、/rust-lang/book、/rust-lang/rust、/apple/swift、/php/php-src、/ghc/ghc。
使用方式:查询需具体,宽泛主题会返回不聚焦结果。示例:query-docs libraryId="/microsoft/typescript" query="tsconfig moduleResolution nodenext";query-docs libraryId="/nixos/nixpkgs" query="buildGoModule vendorHash";query-docs libraryId="/rust-lang/rust" query="Rust edition 2021 to 2024 migration"。行为随版本不同时应显式写明版本。
限制与边界:Context7 回答库本身做什么,不回答本仓库做什么;项目本地证据应改用 Serena 或 Read。优先官方或一手文档。文档不可用或含糊时应如实说明不确定,不可凭记忆填补。Context7 与本地代码冲突时应作为待调查的发现,而非直接取舍;项目约定优先于文档中的通用默认值。相关技能:fact-check 用于非库类断言的外部验证,serena-usage 提供项目本地证据,nix-ecosystem 常与 Context7 抓取配合。