Conversation
📝 WalkthroughWalkthroughReplaces a mode/pagination documentation model with a query/context model: adds ContextRequest/ContextResponse types, introduces fetchLibraryContext and updated searchLibraries signatures, renames tool get-library-docs → query-docs, and bumps MCP server to 2.0.0. Changes
Sequence Diagram(s)sequenceDiagram
participant Client as Client / Tool
participant MCP as MCP Server (tools)
participant API as Context7 API
Client->>MCP: resolve-library-id { query, libraryName }
MCP->>API: GET /v2/libs/search?query=...&libraryName=...
API-->>MCP: SearchResponse (matches or error)
alt library found
MCP-->>Client: libraryId(s)
Client->>MCP: query-docs { query, libraryId }
MCP->>API: GET /v2/context?query=...&libraryId=... \n(X-Context7-Source header)
API-->>MCP: ContextResponse { data: "<documentation text>" } or error
MCP-->>Client: documentation (response.data) or structured error
else no libraries
MCP-->>Client: error ("no libraries found" message)
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
packages/mcp/src/lib/api.ts (1)
110-141: Error handling returns errors inline rather than throwing.The function returns error messages in the
datafield rather than throwing exceptions or using a discriminated union. This works for the current use case where the LLM processes the text directly, but callers cannot programmatically distinguish success from failure.Consider adding an optional
errorfield toContextResponsefor future extensibility:export type ContextResponse = { data: string; error?: boolean; };
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
packages/mcp/src/index.tspackages/mcp/src/lib/api.tspackages/mcp/src/lib/types.ts
🧰 Additional context used
🧬 Code graph analysis (2)
packages/mcp/src/lib/api.ts (3)
packages/mcp/src/lib/types.ts (3)
SearchResponse(16-19)ContextRequest(24-27)ContextResponse(29-31)packages/sdk/src/http/index.ts (1)
request(124-186)packages/mcp/src/lib/encryption.ts (1)
generateHeaders(34-47)
packages/mcp/src/index.ts (1)
packages/mcp/src/lib/api.ts (2)
searchLibraries(72-101)fetchLibraryContext(110-141)
🔇 Additional comments (8)
packages/mcp/src/lib/types.ts (1)
24-31: LGTM! Clean type definitions for the new context-based API.The new
ContextRequestandContextResponsetypes are well-structured and appropriately minimal. They align with the API changes inapi.tsand the tool input schemas inindex.ts.packages/mcp/src/lib/api.ts (2)
66-81: Updated signature aligns with new API design.The
searchLibrariesfunction now accepts separatequeryandlibraryNameparameters, allowing the backend to rank results by relevance to the user's intent. The parameter naming is clear and the JSDoc is updated appropriately.
129-135: Good fallback guidance for empty responses.The empty response handling provides clear, actionable guidance directing users to the
resolve-library-idtool when documentation isn't found.packages/mcp/src/index.ts (5)
101-101: Version bump to 2.0.0 is appropriate.The semver major version increment correctly signals breaking changes: tool rename (
get-library-docs→query-docs), changed input schemas, and modified API behavior.
136-140: Good security guidance for the query parameter.The warning about not including sensitive information (API keys, passwords, credentials, personal data) in the query is important since these values are passed as URL query parameters and could be logged by intermediate proxies or server access logs.
194-231: Clean tool implementation with appropriate security warnings.The renamed
query-docstool has a simplified interface and clear documentation. The handler correctly passes parameters tofetchLibraryContextand returns the response data.
133-134: Tool call limit is guidance-only.The 3-call limit is documented but not enforced programmatically. This is appropriate for LLM clients that respect instructions, but consider adding server-side rate limiting if abuse becomes a concern.
216-230: Handler correctly delegates error messaging to API layer.The tool handler trusts
fetchLibraryContextto return appropriate error messages inresponse.data, maintaining a clean separation of concerns.
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (3)
README.md (3)
1310-1321: Update tool documentation to reflect v2.0.0 breaking changes.The "Available Tools" section still references the old
get-library-docstool name and deprecated parameters (context7CompatibleLibraryID,page,topic). According to the changeset, these have been replaced in v2.0.0:
- Tool renamed:
get-library-docs→query-docs- Parameter renamed:
context7CompatibleLibraryID→libraryId- Parameters removed:
page,topic,mode,limitThis inconsistency will cause user-facing failures when following the documentation.
🔎 Suggested documentation update
-- `get-library-docs`: Fetches documentation for a library using a Context7-compatible library ID. - - `context7CompatibleLibraryID` (required): Exact Context7-compatible library ID (e.g., `/mongodb/docs`, `/vercel/next.js`) - - `topic` (optional): Focus the docs on a specific topic (e.g., "routing", "hooks") - - `page` (optional, default 1): Page number for pagination (1-10). If the context is not sufficient, try page=2, page=3, etc. with the same topic. +- `query-docs`: Retrieves and queries up-to-date documentation and code examples from Context7. + - `libraryId` (required): Exact Context7-compatible library ID (e.g., `/mongodb/docs`, `/vercel/next.js`) + - `query` (required): The specific question or context you need documentation for
961-961: Update Copilot configuration examples with new tool name.These configuration examples still reference the old
get-library-docstool name, which has been renamed toquery-docsin v2.0.0.🔎 Suggested fix
- "tools": ["get-library-docs", "resolve-library-id"] + "tools": ["query-docs", "resolve-library-id"]Also applies to: 986-986, 1000-1000
1138-1138: Update BoltAI example with new tool name.The BoltAI example still references
get-library-docs, which has been renamed toquery-docsin v2.0.0.🔎 Suggested fix
-Once saved, enter in the chat `get-library-docs` followed by your Context7 documentation ID (e.g., `get-library-docs /nuxt/ui`). +Once saved, enter in the chat `query-docs` followed by your Context7 documentation ID (e.g., `query-docs /nuxt/ui`).
🧹 Nitpick comments (1)
packages/mcp/package.json (1)
16-16: LGTM: pack-mcpb script refactored for clarity.The simplified script maintains the same packaging workflow with cleaner syntax and explicit steps.
Note: Consider adding error handling (e.g.,
set -ein bash or chaining with&&) to ensure the script fails fast if any step encounters an error.
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
.changeset/some-suns-turn.mdREADME.mdpackages/mcp/mcpb/context7.mcpbpackages/mcp/mcpb/manifest.jsonpackages/mcp/package.json
🔇 Additional comments (4)
README.md (1)
1347-1379: LGTM: Development commands updated correctly.The migration from bun to pnpm/node commands is consistent and appropriate for the project's tooling updates.
packages/mcp/package.json (1)
3-3: LGTM: Major version bump appropriate for breaking changes.The version bump to 2.0.0 correctly reflects the breaking API changes documented in the changeset (tool rename, parameter changes, API surface updates).
.changeset/some-suns-turn.md (1)
1-27: LGTM: Comprehensive breaking change documentation.The changeset clearly documents the v2.0.0 breaking changes, new features, and improvements. This provides essential context for users upgrading from v1.x.
packages/mcp/mcpb/manifest.json (1)
5-5: LGTM: Manifest updated to reflect v2.0.0 changes.The version bump and tool naming/description updates correctly reflect the new query-based architecture and breaking changes documented in the changeset.
Also applies to: 28-28, 31-32
New architecture to decrease token cost. It re-ranks the library and context snippets.
Summary by CodeRabbit
Breaking Changes
get-library-docs→query-docs.queryandlibraryId(replacing mode/page/topic).resolve-library-idnow acceptsqueryalongsidelibraryName.Behavior Changes
✏️ Tip: You can customize this high-level summary in your review settings.