docs

A command for fetching current documentation and code examples for a software library. It can look up a library by name or use a specific Context7 library and version identifier.

In plain words
What is it for?
Checking how to use libraries such as React, Next.js, or Prisma, including version-specific features and tasks such as authentication, hooks, or database relations.
Why use it?
It reduces the risk of relying on outdated or incorrect API details. It also brings relevant examples into the coding session when documentation is needed.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/upstash/context7/docs
Clone the repo
git clone --depth 1 https://github.com/upstash/context7
Per session 6 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 304 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00006 $0.00304
Opus 5 $0.00003 $0.00152
Sonnet 5 $0.00001 $0.00061
Haiku 4.5 $0.00001 $0.00030

Measured 2d ago against content hash 72bf7645ea0d, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

docs scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

Copies of this mod

2 near-identical copies found in the catalogue:

  • docs — 92% identical, 2 lines differ
  • docs — 92% identical, 2 lines differ
plugins/claude/context7/commands/docs.md · 46 lines

What it actually says

/context7:docs

Fetches up-to-date documentation and code examples for a library.

Usage

/context7:docs <library> [query]
  • library: The library name, or a Context7 ID starting with /
  • query: What you're looking for (optional but recommended; run the command once per distinct concept, unless asking how they interact)

Examples

/context7:docs react hooks
/context7:docs next.js authentication
/context7:docs prisma relations
/context7:docs /vercel/next.js/v15.1.8 app router
/context7:docs /supabase/supabase row level security

How It Works

  1. If the library starts with /, it's used directly as the Context7 ID
  2. Otherwise, resolve-library-id finds the best matching library
  3. query-docs fetches documentation relevant to your query
  4. Results include code examples and explanations

Version-Specific Lookups

Include the version in the library ID for pinned documentation:

/context7:docs /vercel/next.js/v15.1.8 middleware
/context7:docs /facebook/react/v19.0.0 use hook

This is useful when you're working with a specific version and want docs that match exactly.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 46 lines · 6 tokens per session scan A 72bf7645ea0d

Subscribe to this mod's changes

docs is a command published in the GitHub repository upstash/context7 (61,442 stars, last pushed yesterday), licensed MIT. It adds 6 tokens to every session and 304 once invoked, about $0.0000 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.