DEV Community

Cover image for Context7 API With Claude Code: Build the Script and Skill Step by Step
Alex Cloudstar
Alex Cloudstar

Posted on Edited on

Context7 API With Claude Code: Build the Script and Skill Step by Step

In one of my test runs, Claude Code sent a question to the Context7 API phrased from its memory of AI SDK 6. The query read "stopWhen stepCountIs, convertToModelMessages, toUIMessageStreamResponse". The answer came back with isStepCount and createUIMessageStreamResponse, and the model wrote the new code.

That exchange is the whole reason to wire the Context7 API into Claude Code. The model asked with its old picture of the library, and the current docs corrected it. This guide builds the setup step by step: curl calls, a Node script, a skill and one line in CLAUDE.md.

I wired it into a real Next.js project, then gave Claude Code the same task in six fresh copies of it: three with the setup and three without. I read the Context7 API guide on November 30, 2026 and checked each API detail here against it. The service changes often, so if something has drifted, the docs are the source of truth.

What You Need Before You Start

No MCP server needed. You need four things:

  • Node.js 18 or later, for the script. The ctx7 CLI mentioned near the end needs Node 22.13 or later.
  • curl, for the first calls.
  • Claude Code. I ran this on version 2.1.332.
  • A project with a fast-moving library. Mine used the AI SDK, whose 7.0.0 release on June 25, 2026 renamed several everyday calls.

You do not need an API key to start.

Call the Context7 API With curl

Two endpoints do the work, and both live under https://context7.com/api. The first finds the library ID:

curl -G "https://context7.com/api/v2/libs/search" \
  --data-urlencode "libraryName=ai sdk" \
  --data-urlencode "query=stream text with tools in a Next.js route"
Enter fullscreen mode Exit fullscreen mode

The response is JSON, one object per candidate. Each carries the library id (for example /websites/ai-sdk_dev), a title, the indexed versions, a trustScore and a last-updated date. The query does real work: Context7 reranks the results with it.

Next, ask for the docs behind the ID you picked:

curl -G "https://context7.com/api/v2/context" \
  --data-urlencode "libraryId=/websites/ai-sdk_dev" \
  --data-urlencode "query=streamText with tools in a Next.js route handler, AI SDK 7"
Enter fullscreen mode Exit fullscreen mode

By default you get plain Markdown, with a title, a source link, a short description and one code block for each snippet. It can go straight into a context window.

A third endpoint, GET /api/v3/search, combines both steps into one call.

Get a Context7 API Key (or Skip It)

No key is needed to try this. Each valid request I sent with no key came back 200. Those responses carried the headers context7-quota-tier: anonymous and ratelimit-limit: 200, with the window resetting at midnight UTC. No anonymous limit is published, so read 200 as an observation, not a guarantee. The Context7 calls in my test runs were anonymous.

For real use, get a key. A free account includes 1,000 API calls per month. Once they are gone, Context7 adds 20 bonus calls each day. The Context7 plans page listed Pro at $10 per seat with 2,000 calls when I checked on November 30, 2026.

Create the key in the Context7 dashboard. It starts with ctx7sk and is shown once, so copy it right away. Put it in an environment variable and send it as a Bearer token:

export CONTEXT7_API_KEY="ctx7sk-your-key-here"

curl -G "https://context7.com/api/v2/libs/search" \
  -H "Authorization: Bearer $CONTEXT7_API_KEY" \
  --data-urlencode "libraryName=ai sdk" \
  --data-urlencode "query=stream text with tools in a Next.js route"
Enter fullscreen mode Exit fullscreen mode

Never put the key in CLAUDE.md, a skill file or anything else you commit. The script below reads it from the environment.

Build the Context7 API Script

Here is the whole script. Save it as .claude/skills/context7-docs/scripts/c7.mjs. The only requirement is Node 18 or later, and there are no packages to install.

#!/usr/bin/env node

const API_BASE = "https://context7.com/api/v2";
const SEARCH_RESULT_LIMIT = 5;
const USAGE = `Usage:
  c7 search <library name> "<what you are trying to do>"
  c7 docs <library id> "<specific question>"`;

const buildHeaders = () => {
  const apiKey = process.env.CONTEXT7_API_KEY;
  return apiKey ? { Authorization: `Bearer ${apiKey}` } : {};
};

const request = async (path, params) => {
  const url = `${API_BASE}${path}?${new URLSearchParams(params)}`;
  const response = await fetch(url, { headers: buildHeaders() });
  if (!response.ok) {
    throw new Error(`Context7 ${response.status} on ${path}: ${await response.text()}`);
  }
  return response;
};

const searchLibraries = async (libraryName, query) => {
  const response = await request("/libs/search", { libraryName, query });
  const { results } = await response.json();
  return results.slice(0, SEARCH_RESULT_LIMIT).map((library) =>
    [
      library.id,
      library.title,
      `trust ${library.trustScore}`,
      `updated ${library.lastUpdateDate?.slice(0, 10)}`,
      `versions ${library.versions?.join(", ") || "latest only"}`,
    ].join(" | "),
  );
};

const fetchDocs = async (libraryId, query) => {
  const response = await request("/context", { libraryId, query, type: "txt" });
  return response.text();
};

const [command, target, query] = process.argv.slice(2);

if (!command || !target || !query) {
  process.stderr.write(`${USAGE}\n`);
  process.exit(1);
}

if (command === "search") {
  const lines = await searchLibraries(target, query);
  process.stdout.write(`${lines.join("\n")}\n`);
} else if (command === "docs") {
  process.stdout.write(await fetchDocs(target, query));
} else {
  process.stderr.write(`${USAGE}\n`);
  process.exit(1);
}
Enter fullscreen mode Exit fullscreen mode

Three things to notice in that script.

First, the header is built only when CONTEXT7_API_KEY exists. Without it, the script runs anonymous.

Second, search prints one line per library instead of raw JSON. That gives the model what it needs to choose an ID: the publisher, the freshness and the indexed versions.

Third, a failed request throws the status code and the response body. When Context7 answers library_not_found, the model reads the real reason and tries another ID instead of guessing.

Run it once by hand:

node .claude/skills/context7-docs/scripts/c7.mjs search "ai sdk" "stream text with tools in a Next.js route"
Enter fullscreen mode Exit fullscreen mode

If you see one line per library, the script works.

Read the Output Before the Model Does

Here is what that command printed when I ran it on November 30, 2026, with no key. The index changes, so your rows will differ:

/websites/ai-sdk_dev | AI SDK | trust 9.6 | updated 2026-11-13 | versions v4, v5, v6
/convex/ai | AI SDK | trust 10 | updated 2026-11-04 | versions ai_4.3.15, ai_3.4.33
/websites/ai-sdk_dev_cookbook | AI SDK Cookbook | trust 9.6 | updated 2026-07-18 | versions latest only
/websites/ai-sdk-tools_dev | AI SDK Tools | trust 4.1 | updated 2026-10-30 | versions latest only
/grafana/ai-sdk | Grafana AI SDK | trust 10 | updated 2026-11-12 | versions latest only
Enter fullscreen mode Exit fullscreen mode

The title "AI SDK" appears on two different libraries, so the title alone does not pick the row. /convex/ai has a higher trust score, 10, but it is Convex's own library with ai_4.3.15 style versions. The right pick is /websites/ai-sdk_dev, the official docs site. That is why the skill below tells the model to pick the official source by trust score and matching versions.

One more detail in that first row. The versions column says v4, v5, v6, yet AI SDK 7 had shipped months earlier and the docs behind that ID were already v7. The label was stale, and the docs were right. Do not gate anything on that column.

Now the docs call, using the ID from the first row:

node .claude/skills/context7-docs/scripts/c7.mjs docs "/websites/ai-sdk_dev" "streamText with tools in a Next.js route handler, AI SDK 7"
Enter fullscreen mode Exit fullscreen mode

The answer was 8,210 bytes. Here is the start of it, trimmed:

### streamText route handler with tool execution

Source: https://ai-sdk.dev/cookbook/next/human-in-the-loop

Create a route handler that uses streamText and returns a UIMessageStreamResponse. The tool has an execute function that runs automatically when the model calls it.

```ts
import {
  streamText,
  tool,
  createUIMessageStreamResponse,
  toUIMessageStream,
} from 'ai';
```
Enter fullscreen mode Exit fullscreen mode

Read the imports. createUIMessageStreamResponse and toUIMessageStream are the AI SDK 7 names, and the next snippet in the same answer used isStepCount(5).

Add Context7 to Claude Code as a Skill

A script on its own sits idle until the model learns when to call it. A skill handles that. Save this as .claude/skills/context7-docs/SKILL.md:

---
name: context7-docs
description: Fetch current, version-specific documentation for a third-party library or framework from the Context7 API. Use before writing or changing code that calls a library API, especially fast-moving ones (Next.js, AI SDK, React, Zod, Drizzle, Tailwind), and whenever you are not sure an API still exists in the installed version.
---

# Context7 docs lookup

Your training data is older than the libraries in this project. Look up the docs before writing library code.

1. Check the installed version in `package.json` (or the version you are about to install).
2. Find the library ID:

   ```bash
   node .claude/skills/context7-docs/scripts/c7.mjs search "<library name>" "<what you are trying to do>"
   ```

   Pick the official source with the highest trust score whose versions match.
3. Ask one specific question per call, and include the version in it:

   ```bash
   node .claude/skills/context7-docs/scripts/c7.mjs docs "<library id>" "<specific question>"
   ```

4. Write the code from the returned snippets, not from memory. When the docs and your memory disagree, the docs win. When the docs and the installed type definitions disagree, the types in `node_modules` win.
Enter fullscreen mode Exit fullscreen mode

Two parts of that file do most of the work. The description tells Claude Code when the skill applies, and the fast-moving library names make it match the right tasks. Step 4 settles conflicts in advance. Docs can trail the code, so the installed types have the last word on whether code compiles. They do not say which name is current, which is why the docs come first.

When you are done, the project should look like this:

your-project/
  CLAUDE.md
  .claude/
    skills/
      context7-docs/
        SKILL.md
        scripts/
          c7.mjs
Enter fullscreen mode Exit fullscreen mode

Tell Claude Code to Use It: The CLAUDE.md Line

A skill on disk is an option. A rule in CLAUDE.md makes it the default:

Before writing or changing code that uses a third-party library, look up the current docs with the `context7-docs` skill. Do not rely on memory for library APIs.
Enter fullscreen mode Exit fullscreen mode

I did not test the skill without this line. Context7's tips page suggests adding a CLAUDE.md rule, so that you never have to type "use context7" by hand, and at least one third-party guide reports that the agent skips the tool when no rule exists. Add the rule.

Now try it. Give Claude Code a task that touches a fast-moving library, such as a streaming chat route with the AI SDK, and watch the transcript for a search call and a docs call or two before any code appears. In my runs the count was exactly three per task.

The Results: Six Runs, Same Task

The task was an "Ask this post" feature on a Next.js 16.4 blog I run: a streaming route with one tool and a useChat client component, built on ai@7.0.185. Each run used its own fresh copy of the repo at the same commit. The setup:

  • Claude Code 2.1.332, headless, default model (Claude Opus 5.5).
  • Plugins and hooks of mine switched off, and no MCP servers connected. Built-in plugins, my user-level skills and one synced plugin still loaded. So did my global CLAUDE.md, in every run, and the built-in claude-api skill triggered in 5 of 6 runs, across both sides.
  • Web search allowed on both sides. No run used it.
  • The prompt never mentioned Context7.

There is a confound here. Alongside the tool, the Context7 copies carried an instruction to consult docs. The other copies carried none, not even a pointer to node_modules/ai/docs. So this tests the tool plus the instruction, not the tool alone. It is also three runs per side on a single task, a small sample and no benchmark, and none of the six routes was ever called against a live model.

AI SDK 6 names in final code Type-check Avg time Avg cost
Without Context7 (3 runs) 2 of 3 runs 3 of 3 pass 131 s $1.42
With Context7 (3 runs) None of the three I searched for 3 of 3 pass 124 s $1.15

Every run passed bunx tsc --noEmit, so the type-check could not separate the two sides. The old names did. Run 2 returned result.toUIMessageStreamResponse(). Run 3 did the same and also used stepCountIs. stepCountIs is a plain export alias with no deprecation marker, while toUIMessageStreamResponse is marked @deprecated and is documented as removed in the next major release. Nothing I ran flagged either one.

Runs 2 and 3 learned the API by grepping the type definitions, and they did search for @deprecated. That is how they read the notes on system and isStepCount. For toUIMessageStreamResponse, though, their searches matched only the declaration line, so its @deprecated note never reached them, and stepCountIs has no marker at all. A grep of the type definitions tells the model what exists, not what is current, unless it searches for deprecation notes name by name. Run 1 probed node_modules/ai/docs in its first inspection command, found the docs, read them, and used none of the old names. The Context7 runs also checked their code against the installed types after the lookups, as step 4 of the skill says.

Treat cost as unproven. The figure is what Claude Code reports at API list prices, which is not a bill. The averages are $1.15 with Context7 and $1.42 without, but the cheapest run ($0.84) is the only run where the built-in claude-api skill did not load, and that skill adds about 129,000 characters of context. Across the five runs where it loaded, the average was $1.31 with Context7 against $1.42 without. Wall time was about the same.

Reproduce My Test on Your Own Codebase

You can run the same comparison on your own project. You need two clones at the same commit with dependencies installed, and three small files in a folder next to them. First prompt.txt, the exact prompt I used. Swap in your own task, but keep it identical across both sides:

Add an "Ask this post" feature to this blog.

1. A POST route at app/api/ask/[slug]/route.ts. It receives { messages } from the AI SDK useChat hook and streams an answer using the AI SDK (the `ai` package, install the latest version) with the model string "anthropic/claude-sonnet-5.5" through the Vercel AI Gateway. Give the model one tool, getSection, that takes a heading and returns that section of the post's MDX content. Allow up to 4 steps so it can call the tool and then answer. Return 404 for an unknown slug.
2. A small client component at components/ask-post.tsx that uses useChat from @ai-sdk/react to talk to that route for a given slug, and renders the messages (text parts and tool calls) plus an input to send a question. Do not wire it into any page.

Use bun to install packages. Before finishing, make sure `bunx tsc --noEmit` passes. Keep it minimal.
Enter fullscreen mode Exit fullscreen mode

Next, settings.json. It switches off hooks and the plugins you list, in the name@marketplace form from your own config:

{
  "disableAllHooks": true,
  "enabledPlugins": {
    "your-plugin@your-marketplace": false
  }
}
Enter fullscreen mode Exit fullscreen mode

Then mcp.json, an MCP config with no servers:

{"mcpServers": {}}
Enter fullscreen mode Exit fullscreen mode

Run this from inside each clone, with EXP pointing at the folder that holds the three files. Use a fresh clone for every run, and copy the skill folder and the CLAUDE.md line into the Context7 clones only:

EXP="$HOME/c7-test"
claude -p "$(cat "$EXP/prompt.txt")" \
  --settings "$EXP/settings.json" --strict-mcp-config --mcp-config "$EXP/mcp.json" \
  --permission-mode acceptEdits --allowedTools Bash Edit Write Read Glob Grep WebFetch WebSearch Skill \
  --no-session-persistence --output-format stream-json --verbose \
  > "$EXP/log-with-1.jsonl"
Enter fullscreen mode Exit fullscreen mode

To score a run, type-check the clone and grep the generated code for the old names. For this task those were stepCountIs, system (deprecated in favor of instructions) and toUIMessageStreamResponse. The cost comes from the log: the stream-json output has a result event with total_cost_usd.

bunx tsc --noEmit
grep -rnE "stepCountIs|toUIMessageStreamResponse|system:" app components
jq 'select(.type == "result") | .total_cost_usd' "$EXP/log-with-1.jsonl"
Enter fullscreen mode Exit fullscreen mode

The system: pattern can match unrelated code, so check each hit. Your runs will still load built-in plugins and your global CLAUDE.md, as mine did. Run each side three times and read the logs.

JSON Mode and Version Pinning

The script asks for plain text because the model reads it directly. For filtering, caching or your own tooling, add type=json. This call and jq filter list what came back, ordered by rank:

curl -sG "https://context7.com/api/v2/context" \
  --data-urlencode "libraryId=/websites/ai-sdk_dev" \
  --data-urlencode "query=isStepCount stopWhen" \
  --data-urlencode "type=json" \
  | jq -c '[(.codeSnippets[] | {kind:"code", title:.codeTitle, tokens:.codeTokens, rank}),
            (.infoSnippets[] | {kind:"info", title:.breadcrumb, tokens:.contentTokens, rank})]
           | sort_by(.rank | tonumber)[]'
Enter fullscreen mode Exit fullscreen mode

Output from my run on November 30, 2026:

{"kind":"code","title":"isStepCount","tokens":378,"rank":1}
{"kind":"code","title":"Stop generateText after 5 steps with isStepCount","tokens":115,"rank":2}
{"kind":"code","title":"Replace maxSteps with stopWhen using isStepCount","tokens":73,"rank":3}
{"kind":"info","title":"isStepCount","tokens":54,"rank":4}
{"kind":"info","title":"Multi-Step Calls (using stopWhen)","tokens":198,"rank":5}
Enter fullscreen mode Exit fullscreen mode

The response has two lists, codeSnippets and infoSnippets. Each item carries a rank, its position across both lists, so sort them together to match the text version. Code snippets also carry codeTokens and a codeId URL, so you can drop anything over a token budget before it reaches the model.

For versions, pass the version parameter. It takes a plain version such as 7.0.185, and values copied from a package file, such as ^15.4.3 or 15.x, also work. The parameter wins over an ID suffix. A string that is not a version, such as any, returns 400 with validation_error and "Invalid version". I confirmed that with a live call.

If the exact version is not indexed, the request still succeeds with the closest docs: a matching tag, then the newest stable release of that line, then current docs. The JSON response then includes a version object. Asking for 7.0.185 on /websites/ai-sdk_dev gave this:

{"libraryId":"/websites/ai-sdk_dev","requested":"7.0.185","served":null,"status":"unverified"}
Enter fullscreen mode Exit fullscreen mode

The status unverified means Context7 could not confirm that version, yet the docs still came back. A script that cares about exact versions should check the field.

The One-Call v3 Search Endpoint

GET /api/v3/search takes a question and picks the libraries for you. No library ID is needed:

curl -G "https://context7.com/api/v3/search" \
  --data-urlencode "query=AI SDK 7 stream text with tools in a Next.js route" \
  --data-urlencode "library=ai sdk"
Enter fullscreen mode Exit fullscreen mode

The library parameter is a hint, either a fuzzy name or an exact ID, and you can repeat it up to four times. Add context=broad and the response appends up to about 3,500 more tokens of the best-matching pages. The text response starts with a line such as Library: /websites/ai-sdk_dev, so you can see which source it chose.

It costs one quota call instead of two, but the answers were larger than a targeted v2/context call in my samples. One was about 2.6 times larger, and the v3 answers I pulled on November 30, 2026 ran roughly 10 KB (9,863 to 11,619 bytes) against 8,210 bytes for a similar v2 question. For Next.js it also picked /websites/nextjs over /vercel/next.js.

Use v3 when a quick grounding step is enough. Use the two-step flow when you need to pick the exact source. The Context7 docs say the same.

Troubleshooting the Context7 API

Start with the status code. This table covers the ones I would expect to meet:

Status error value What it means What to do
400 validation_error A bad parameter, such as a version string that is not a version Fix the parameter and retry
400 invalid_library_id A malformed ID such as not-a-valid-id Use the /owner/repo format, or an ID from search
401 invalid_api_key The key is wrong or malformed Check the ctx7sk prefix and the environment variable
402 spending_limit_exceeded A monthly spending limit was reached Check your plan and usage
404 library_not_found, version_not_found The ID or version does not exist Search again and use the ID it returns
429 rate limit Too many calls Wait for Retry-After, back off and cache

A 202 on v2/context means the library is not finalized yet, so retry. A 404 no_documentation_found from v3/search is an empty result, not a failure.

Wrong library ID. A Next.js search listed /vercel/next.js and /websites/nextjs, which are two near-duplicate sources. In my sample, v3/search picked the website one. IDs always start with /. A malformed ID like not-a-valid-id returns 400 invalid_library_id ("Expected format: /owner/repo"), while a well-formed ID that does not exist returns 404 library_not_found. Search again and let the trust score and versions decide.

A version label you cannot trust. When the exact version matters, put it in the question, as the skill does, or pass the version parameter and check the version object in JSON mode.

401 invalid_api_key. Check the ctx7sk prefix, then check that the variable is set in the shell where Claude Code runs. A 403 with api_key_admins_only or api_keys_disabled means a teamspace policy blocked the key.

429. The response carries Retry-After and RateLimit-* headers, and the docs recommend exponential backoff and caching. My script does not retry. It throws, and the model sees the status.

Costs and Security

Every lookup spends API calls. The two-step flow costs two calls, so the free plan covers about 500 lookups a month by my arithmetic. My test task used three calls per run, roughly 330 tasks. GET /api/v2/usage reports your usage and is not counted as a request, but it needs an API key and returns 401 without one.

Docs cost tokens. In my runs a docs answer came to about 5,000 to 8,000 characters, which I estimate at 1,500 to 2,000 tokens. Ask one specific question per call.

Docs are untrusted input. Whatever you feed a model from outside sources is an injection surface, and Context7 has had a real case. In February 2026 Noma Labs reported ContextCrush. Library owners could add custom rules, up to 50 rules of 255 characters each, and the MCP server sent them to agents verbatim as trusted instructions. Noma's proof of concept told an agent to read .env, post it to an attacker's GitHub repo as an issue, and delete files.

Context7 fixed it server-side on February 23, 2026, so no upgrade was needed, and says it saw no exploitation in the wild. Its postmortem lists the mitigations. A classifier screens docs before indexing, and flagged content is not indexed. Teamspace policies restrict which libraries your team can pull from, and they exist on the Free plan too.

Your own habits still matter. A script gives you a place to filter text before it reaches the model, which an MCP tool result does not. Keep shell, file and network actions behind permission prompts, and keep secrets out of plaintext .env files in directories the agent can read. Context7 says it receives only the lookup query and library name, not your code or conversation, so keep secrets out of queries too. The security best practices page covers the rest.

Optional: The TypeScript SDK Instead of a Script

Context7 also publishes a TypeScript SDK, @upstash/context7-sdk. I did not use it, so I cannot say how it behaves in an agent loop. Per the SDK docs, search calls the v3 endpoint, searchLibrary and getContext map to the two-step flow, and the client retries failed GET requests up to five times on statuses such as 429 and 503, which covers the retry logic my script leaves out.

When to Use MCP or ctx7 Setup Instead

If you want Context7 working in two minutes, use the official setup. It needs Node 22.13 or later:

npx ctx7 setup --claude
Enter fullscreen mode Exit fullscreen mode

The command handles sign-in, creates an API key, and sets up one of two modes: the MCP server, or a skill that runs the ctx7 CLI and is meant to trigger on its own. The ctx7 CLI docs list the flags. The manual MCP route is one command:

claude mcp add --scope user --header "Authorization: Bearer YOUR_API_KEY" --transport http context7 https://mcp.context7.com/mcp
Enter fullscreen mode Exit fullscreen mode

The official Claude Code plugin installs with two commands. It does not read CONTEXT7_API_KEY, so you sign in through /mcp:

/plugin marketplace add upstash/context7
/plugin install context7@context7-marketplace
Enter fullscreen mode Exit fullscreen mode

The Context7 Claude Code page covers all of these. The MCP server's source and the official skills live in the open-source repo.

So why a script? An MCP tool needs an MCP client to call it, such as Claude Code itself, including its mcp_tool hooks. A pre-commit script or a plain CI step has no such client. The script is a plain HTTP request that runs anywhere, and it lets me decide what text reaches the model. An MCP lookup costs one or two API calls, one if the model already has the library ID.

Pick MCP or ctx7 setup for speed. Pick the API when a pre-commit script or CI step needs the docs, or when you want to control the output.

Frequently Asked

Can I call the Context7 API without a key? Yes. The API answered every valid request I sent without one. The response headers showed a quota tier of anonymous and a limit of 200, with a reset at midnight UTC. Context7 publishes no anonymous number, so create a free key before you rely on it.

Where do I create a Context7 API key? Open the settings tab of the Context7 dashboard and use the API Keys card. The key begins with ctx7sk and appears only once. npx ctx7 setup can generate one for you too.

How many calls does the free Context7 plan include? It costs $0 and includes 1,000 API calls a month. After that, Context7 grants 20 more each day until the month resets. Pro adds 2,000 calls per seat for $10 a month.

How many Context7 skills are there for Claude Code? Context7 ships three in its repo: context7-mcp, context7-cli and find-docs. The context7-docs skill in this guide is my own addition, and it calls the REST API directly.

Next Step

For the fast path, run npx ctx7 setup --claude. For control, keep the script and the skill from this guide.

Then give Claude Code a task you finished last week, count the Context7 calls in the transcript, and search the diff for old names. Three calls was normal for mine.

Top comments (1)

Collapse
 
userxnom profile image
Abdullah Naseer •

The confound you admit is the most honest part of the post — the Context7 side also carried the instruction to consult node_modules/ai/docs, so the test measured tool plus instruction, not the tool alone. With three runs per side, that is the first thing I would want to separate: a third arm with the instruction but no Context7 would tell you how much of the win was the docs lookup and how much was just pointing the model at the right folder.

The finding that stayed with me is the @deprecated one. Type-checking passed on all six runs, and grepping type definitions shows the model what exists but never shows it what is deprecated — that is exactly the gap a docs lookup fills. The "unverified" version status is the other trap worth flagging: docs served anyway, so a script that cares about versions has to check the version object, not just the 200.

One question on the trade-off: with one of your v3 samples coming back about 2.6 times larger than a targeted v2/context call, do you still default to the two-step flow whenever the exact version matters, and reach for v3 only for a quick grounding step?