Search Official Docs with Context7
Build a CLI that finds official code snippets within a token budget.
Introduction
30 Second Summary
Coding assistants can sound confident while suggesting functions that do not exist. Checking every answer against library documentation takes time.
In this project, you will build a command-line lookup tool called docs-ask using Context7 Search. It turns a coding question into a budget-sized evidence pack that a model can answer with traceable documentation.
What You'll Build
You will run docs-ask with a coding question to get a compact evidence pack whose snippets each point back to an official source page.
By the end of this project, you'll have:
- An official documentation search that reveals which library IDs answer questions about two different libraries.
- A reusable docs-ask script that prints each snippet's title plus source URL plus token count within your chosen budget.
- A grounded model answer whose claims cite documentation pages you can open for yourself.
- Secret Mission: An optional challenge to push your documentation-grounding skills further.
Are there any prerequisites?
You need a terminal with curl plus either Node or Python for the script. Keyless demo requests are rate-limited by IP address.
Before We Start
Your documentation lookup starts in the terminal. Missing request tools would stop every later step before the search begins.
The curl command sends HTTPS requests. The jq command makes JSON responses readable before you confirm that Context7 Search is reachable.
In this step, get ready to:
- Verify that curl can send web requests.
- Verify that jq can process JSON responses.
- Confirm unauthenticated access to Context7 Search.
Verify curl in your terminal
A terminal gives you a direct place to send requests with curl. Its version check confirms that your operating system can find the command.
macOS
- Press Cmd+Space to open Spotlight.
- Type Terminal in the search field.
- Press Enter to open Terminal.
Windows
- Press the Windows key to open system search.
- Type PowerShell in the search field.
- Press Enter to open PowerShell.
Linux
- Open your applications menu.
- Type Terminal in the search field.
- Select the terminal application from the results.
- Check whether curl is available by running this command:
curl --version
What does this check show?
The first output line identifies your installed curl version. The remaining output lists the protocols supported by that installation.
✔️ I see curl version details
Good start. Your terminal can send web requests with curl.
ⓧ Command not found
Curl must be installed before your terminal can contact Context7 Search. The official installation guide provides options for each operating system.
- Open the official curl installation guide.
- Select the installation option for your operating system.
- Complete the instructions shown on the guide.
- Close your current terminal after the installation finishes.
- Open a new terminal through system search.
- Confirm the installation by running this command:
curl --version
What does this check show?
A curl version line confirms that your new terminal can locate the installed command.
You should now see curl version details in your terminal.
Still missing curl?
Confirm that you selected a download matching your operating system. Reopen your terminal after completing every installation prompt.
If the command remains unavailable, help me check my curl installation.
Verify jq for JSON responses
API responses contain nested fields that can be difficult to scan as plain text. The jq command formats that structure for your terminal.
- Check whether jq is available by running this command:
jq --version
What does this check show?
The command prints the installed jq version before exiting. A version line confirms that your terminal can locate the executable.
✔️ I see a jq version
Your response toolkit is ready. Your terminal can now process structured API output.
ⓧ Command not found
Jq is distributed as a command-line program. Choose your operating system to install it using an option listed by the jq project.
macOS
The official jq download guide supports installation through Homebrew on macOS.
- Install jq through Homebrew by running this command:
brew install jq
What does this command do?
Homebrew downloads the jq package. It also makes the command available in your terminal.
- Verify the installation by running this command:
jq --version
What does this check show?
A jq version line confirms that the installation completed successfully.
You should now see a jq version in Terminal.
Homebrew unavailable?
Use the official jq download page to choose the macOS binary that matches your computer.
If you need guidance, help me install jq on macOS.
Windows
The Windows Package Manager can install jq from PowerShell.
- Install jq with Windows Package Manager by running this command:
winget install jqlang.jq
What does this command do?
Windows Package Manager downloads jq. It registers the executable for PowerShell.
- Close PowerShell after the installation finishes.
- Open a new PowerShell window through system search.
- Verify the installation by running this command:
jq --version
What does this check show?
A jq version line confirms that PowerShell can locate the installed executable.
You should now see a jq version in PowerShell.
Jq still unavailable?
Use the official jq download page if Windows Package Manager cannot find the package.
If you need another installation option, help me install jq on Windows.
Linux
Debian-based Linux distributions provide jq through their package repositories. Your terminal may request your local administrator password.
- Install jq from the Debian or Ubuntu repository by running this command:
sudo apt-get install jq
What does this command do?
The package manager downloads jq from the configured repository. It makes the command available to your terminal.
- Verify the installation by running this command:
jq --version
What does this check show?
A jq version line confirms that the package installed successfully.
You should now see a jq version in your terminal.
Using another Linux distribution?
The official jq download page lists installation commands for other Linux package managers.
If your distribution uses another package manager, help me choose the correct jq installation command.
Confirm Context7 Search access
A REST endpoint lets your terminal exchange data with a service over the web. This check proves that your connection can reach the search endpoint without an API key.
Before you send the request, do you expect a JSON response or a network error?
macOS
- Send a test question to Context7 Search by running this command:
curl -G 'https://context7.com/api/v3/search' \
--data-urlencode 'query=How do I stream an OpenAI response from a Next.js route handler?' | jq '.'
What does this request do?
- Curl sends the coding question through the endpoint's query parameter.
- Context7 Search returns matching documentation snippets.
- Jq formats the returned JSON for easier reading.
Windows
- Send a test question to Context7 Search by running this command:
curl.exe -G "https://context7.com/api/v3/search" --data-urlencode "query=How do I stream an OpenAI response from a Next.js route handler?" | jq "."
What does this request do?
- Curl sends the coding question through the endpoint's query parameter.
- Context7 Search returns matching documentation snippets.
- Jq formats the returned JSON for easier reading.
Linux
- Send a test question to Context7 Search by running this command:
curl -G 'https://context7.com/api/v3/search' \
--data-urlencode 'query=How do I stream an OpenAI response from a Next.js route handler?' | jq '.'
What does this request do?
- Curl sends the coding question through the endpoint's query parameter.
- Context7 Search returns matching documentation snippets.
- Jq formats the returned JSON for easier reading.
You should see formatted documentation results with library details. The results also include source information for the returned snippets.
Anonymous request limits
Requests without an API key work for demos. Context7 Search rate-limits these requests by IP address.
Keep your setup checks brief. Repeated tests from the same network use the shared allowance.
No documentation response?
Confirm that your internet connection can reach Context7. A firewall or proxy may block the request.
Pause before retrying if the response mentions a request limit. Unauthenticated requests share the allowance for your IP address.
If the request still fails, help me troubleshoot the Context7 Search request.
That completes your setup. Curl can send the request while jq makes the response readable.
Your command-line toolkit is ready. Next, you will send your first coding question and inspect the returned documentation fields.
Search Official Documentation
Coding agents can invent APIs when they answer from memory. A plausible answer can still contain methods or parameters that do not exist.
You can replace that guesswork with evidence from Context7 Search. Its REST endpoint searches documentation published by library maintainers.
In this step, you will send one coding question without an API key. You will inspect the returned JSON for the snippet text plus its source details.
In this step, get ready to:
- Send one unauthenticated coding question to Context7 Search.
- Read the formatted JSON response.
- Identify the source fields for a returned snippet.
Send your first search request
A specific question gives the search service enough context to select relevant libraries. The type=json parameter returns structured fields that you can inspect.
Before you run this request, which details do you expect each documentation snippet to include?
- Send the coding question as an unauthenticated JSON request by running this command:
curl -G 'https://context7.com/api/v3/search' \
--data-urlencode 'query=How do I stream an OpenAI response from a Next.js route handler?' \
--data 'type=json' | jq '.'
What does this request do?
- The Search endpoint chooses relevant libraries for your coding question.
- The query parameter carries your natural-language question.
- The type=json parameter requests a structured response.
- The jq '.' filter validates the JSON before pretty-printing it.
You should see a top-level codeSnippets array in the terminal. Its objects contain documentation snippets from libraries selected for your question.
No documentation snippets?
Unauthenticated demo requests are rate-limited by IP address.
- Check your internet connection before retrying the request.
- Wait before retrying if the response mentions rate limiting.
- Confirm that the command includes type=json if the response is plain text.
Ask for help diagnosing my Context7 Search response.
Inspect the returned evidence
Each result connects a code example to the library that supplied it. The response also carries a source URL so you can trace the snippet back to its documentation.
- Locate the codeSnippets array near the top of the response.
- Find the first libraryId value inside that array.
- Read the matching codeTitle value.
- Read the matching codeId URL.
- Find the code value inside codeList.
- Find the matching codeTokens value.
Each libraryId names the indexed library. Each codeTitle names the returned snippet.
The codeId value is the source URL. The code value holds the snippet text.
The codeTokens value reports the snippet's token count. That number gives your future CLI a way to manage its context budget.
Your first grounded lookup works. You can now connect a coding snippet to its library plus its original documentation source.
✔️ I found the snippet fields
Great. Your terminal response includes a library ID plus a title for each inspected snippet.
It also includes a source URL plus snippet text. The token count completes the evidence you need for budget planning.
ⓧ I'd like to double check the full request
The complete unauthenticated request is shown below for comparison.
curl -G 'https://context7.com/api/v3/search' \
--data-urlencode 'query=How do I stream an OpenAI response from a Next.js route handler?' \
--data 'type=json' | jq '.'
You have proved that one question can return sourced documentation without an API key. Next, you will compare searches across two different libraries.
Compare Library Results
Your first request proved that Context7 Search can return sourced snippets. One result set cannot show how the selected library changes the evidence.
In this step, you will ask the same state-management question for React. You will repeat it for Vue. This controlled comparison reveals how library IDs, snippet titles, source URLs, and token counts change.
In this step, get ready to:
- Search React documentation with a focused library hint.
- Repeat the question with a Vue library hint.
- Compare the returned evidence across both result sets.
Search React documentation
A library hint guides the search toward one framework. Keeping the question fixed gives you a clean baseline for comparison.
- Send the state-management question with the React hint by running this command:
curl -G 'https://context7.com/api/v3/search' \
--data-urlencode 'query=How do I create and update component state?' \
--data-urlencode 'library=React' \
--data 'type=json' |
jq '.codeSnippets[] | {libraryId, codeTitle, codeId, codeTokens}'
What does this command show?
- The query value keeps the coding question focused on component state.
- The library value guides Context7 Search toward React documentation.
- The jq filter visits every item in codeSnippets.
- The codeId value contains the source URL for each snippet.
- The codeTokens value reports the snippet's code token count for budget planning.
- Check the output for React-related libraryId values.
- Match each codeTitle with its codeId URL.
- Notice the numeric codeTokens value beside each snippet.
You should see compact objects containing React-related library IDs, snippet titles, documentation URLs, and numeric token counts. That gives you a readable React baseline.
Can't see React results?
- Check that the pipe character appears immediately before the jq filter.
- Confirm that the response format is set to type=json.
- Pause before retrying if repeated unauthenticated requests reach the IP rate limit.
Help me diagnose an empty or invalid React search response.
Search Vue documentation
The second request uses the same question. Only the library hint changes, which makes the two outputs directly comparable.
Before you run the second search, do you expect its library IDs and snippet titles to match the React results?
- Send the same question with the Vue hint by running this command:
curl -G 'https://context7.com/api/v3/search' \
--data-urlencode 'query=How do I create and update component state?' \
--data-urlencode 'library=Vue' \
--data 'type=json' |
jq '.codeSnippets[] | {libraryId, codeTitle, codeId, codeTokens}'
What changed in this request?
- The coding question stays identical to the React request.
- The library hint now contains Vue.
- The same jq filter keeps the comparison fields consistent.
- Check the output for Vue-related libraryId values.
- Review the returned codeTitle values.
- Inspect the codeId URLs.
- Notice how the codeTokens values vary between snippets.
You should now see Vue-focused library IDs with different snippet titles. The source URLs and token counts reflect the documentation selected for Vue.
Can't see Vue results?
- Confirm that the library hint is spelled Vue.
- Check that the jq filter starts from codeSnippets.
- Pause before another request if the endpoint stops responding after repeated unauthenticated searches.
Help me troubleshoot my Vue search output.
Compare the returned evidence
Both requests used the same coding question. The differing library hint lets you connect each change in the output to the framework being searched.
Before you compare the fields line by line, which parts of the result do you expect to change most?
- Scroll back to the React result in your terminal.
- Compare its libraryId values with the Vue result.
- Compare the two sets of codeTitle values.
- Compare the framework paths inside the codeId URLs.
- Compare the numeric codeTokens values for snippets of different sizes.
You should see separate library namespaces for React and Vue. Their titles point to different framework patterns.
You have now proved that one question can retrieve distinct evidence for different libraries. Each result still carries a source URL and a token count you can inspect.
Your comparison is complete. Next up, you will wrap the search request in a script that prints sourced snippets in a reusable format.
Build the docs-ask Script
Your earlier searches proved that Context7 Search can find official documentation across different libraries. Repeating the request by hand would slow down every future lookup.
In this step, you will package that request into docs-ask. The script turns one coding question into readable snippets with the evidence attached.
In this step, get ready to:
- Create an executable docs-ask script.
- Parse the JSON response into readable fields.
- Verify that each snippet includes its title, library ID, source URL, token count, and content.
Turn the request into a command
A command-line wrapper gives the search request a stable interface. You can change the question without rebuilding the request.
- In the terminal from earlier, write the script to ~/Desktop/docs-ask by running this command:
cat > ~/Desktop/docs-ask <<'EOF'
#!/usr/bin/env bash
# Require a coding question before calling the API.
if (( $# == 0 )); then
echo "Usage: docs-ask <coding question>" >&2
exit 1
fi
# Preserve the complete question as one request value.
question="$*"
# Request structured snippets from Context7 Search.
response=$(curl -G 'https://context7.com/api/v3/search' \
--data-urlencode "query=$question" \
--data 'type=json')
# Format every code snippet with its source metadata.
jq -r '
.codeSnippets[]?
| "Title: \(.codeTitle)\nLibrary: \(.libraryId)\nSource: \(.codeId)\ncodeTokens: \(.codeTokens)\n\nContent:\n\(.codeList | map(.code) | join("\n\n"))\n\n---"
' <<< "$response"
EOF
chmod +x ~/Desktop/docs-ask
What does this script do?
- The argument check stops the script when a coding question is missing.
- The $* value preserves every word in the question.
- The curl request sends the question to the search endpoint.
- The type=json value requests a structured response that jq can parse.
- The .codeSnippets[]? filter visits every available code snippet.
- The map() filter gathers every code example within one snippet.
- The join() filter keeps those examples under one metadata header.
Before you run it, what range of libraries do you expect one coding question to cover?
- Ask about React effects by running this command:
~/Desktop/docs-ask "How do I use React useEffect?"
What should I see?
You'll see several snippet blocks separated by ---. Each block begins with its source metadata.
The code from the official documentation appears below the Content: label. The exact snippets can change as Context7 updates its index.
That is a useful milestone. Your question now becomes sourced documentation in one command.
Script not running?
If the script cannot execute, confirm that the final chmod line ran after the closing EOF marker.
If parsing stops after several rapid tests, pause before trying again. The unauthenticated limit from earlier still applies.
Help me troubleshoot my docs-ask script.
Confirm every snippet is traceable
A useful agent input needs enough metadata for you to audit its origin. The fields around each snippet preserve that trail.
Before you inspect the first block, do you expect any of the required fields to be missing?
- Find the first Title: line in the terminal output.
- Locate the Library: line directly below the title.
- Confirm the Source: line contains a full documentation URL.
- Find the codeTokens: value for the same snippet.
- Scan the snippet below the Content: label.
You should find all four metadata lines above the snippet content. The next result begins after ---.
✔️ Awesome, I've got everything!
Great. Your executable docs-ask file is saved on your Desktop.
ⓧ I'd like to double check the full code
Compare your docs-ask file with this complete version.
#!/usr/bin/env bash
# Require a coding question before calling the API.
if (( $# == 0 )); then
echo "Usage: docs-ask <coding question>" >&2
exit 1
fi
# Preserve the complete question as one request value.
question="$*"
# Request structured snippets from Context7 Search.
response=$(curl -G 'https://context7.com/api/v3/search' \
--data-urlencode "query=$question" \
--data 'type=json')
# Format every code snippet with its source metadata.
jq -r '
.codeSnippets[]?
| "Title: \(.codeTitle)\nLibrary: \(.libraryId)\nSource: \(.codeId)\ncodeTokens: \(.codeTokens)\n\nContent:\n\(.codeList | map(.code) | join("\n\n"))\n\n---"
' <<< "$response"
Your lookup command now turns coding questions into readable documentation snippets. Next, you'll add a token budget so only the snippets that fit reach your model.
Limit Results by Token Budget
Your docs-ask command now turns a coding question into sourced snippets from Context7 Search. Each result already shows its codeTokens value.
A model has a limited context budget. Printing every result can leave less room for the coding question.
In this step, you will add a token budget flag. Your script will use it to keep the cumulative snippet total within a requested limit.
In this step, get ready to:
- Add a token-budget flag to docs-ask.
- Filter snippets using their cumulative codeTokens total.
- Compare the output from two different token budgets.
Add the token-budget flag
The new flag gives each run a clear limit. Read its value as a whole number because codeTokens is reported as a count.
- In the docs-ask source file from earlier, update the argument handling so --token-budget captures a whole-number value alongside the coding question.
- Save the docs-ask source file.
Before you test the new flag, do you expect the script to accept the budget while preserving its existing snippet output?
- Test the argument handling with a large budget by running this command:
./docs-ask "How do I stream an OpenAI response from a Next.js route handler?" --token-budget 100000
What does this run prove?
The large budget leaves room for the normal result set. Seeing the usual snippet fields proves that the script accepts the question plus the new flag.
Each result should still include its title. It should also include its library details plus source URL plus codeTokens value plus content.
Is the new flag rejected?
- Check that the argument handler uses the exact flag name --token-budget.
- Confirm that the parser reads the whole number immediately after the flag.
- Confirm that the quoted coding question remains one argument.
Ask for help with the parser if the command still fails: help me debug the token-budget argument in docs-ask
Filter snippets by cumulative tokens
A cumulative budget tracks the total cost of every accepted snippet. The next snippet is printed only when its token count still fits inside the remaining allowance.
How does cumulative budgeting work?
- Start the running token total at 0.
- Calculate the proposed total before printing each snippet.
- Print the snippet only when the proposed total stays within the requested budget.
- Add the accepted snippet's codeTokens value to the running total.
Keep the existing formatter for accepted snippets. Every printed result must retain its title plus library details plus source URL plus token count plus content.
- Replace the existing unconditional snippet loop with the cumulative budget logic described above.
- Save the docs-ask source file.
Before you run the two checks, which budget do you expect to return the longer snippet list?
- Test the lower budget by running this command:
./docs-ask "How do I stream an OpenAI response from a Next.js route handler?" --token-budget 1
What does the lower run test?
The budget of 1 sits below the snippet token counts you inspected earlier. You should see no regular snippets from this run.
That empty result proves the script rejects snippets that would exceed the available allowance.
- Test the higher budget with the same question by running this command:
./docs-ask "How do I stream an OpenAI response from a Next.js route handler?" --token-budget 100000
What does the higher run test?
The larger allowance gives the filter room to accept snippets. You should see a longer list with the same source details as before.
The sum of the printed codeTokens values must remain at or below 100000.
- Compare the two terminal outputs to confirm that the lower budget returned fewer snippets.
That comparison proves your budget guard is working. docs-ask now returns only the documentation that fits inside the requested context allowance.
Do both runs show the same snippets?
- Check that the loop compares the proposed cumulative total against the requested budget before printing.
- Check that the running total increases only after a snippet is accepted.
- Confirm that the filter reads each snippet's codeTokens value as a number.
Ask for help if the cumulative total still exceeds the limit: help me debug the cumulative codeTokens filter in docs-ask
✔️ Awesome, I've got everything!
Your saved docs-ask script now accepts a coding question plus a token budget. The lower-budget run returns a shorter snippet list.
ⓧ I'd like to double check the budget logic
Compare your implementation against this behavior checklist.
- The script accepts a coding question through its existing interface.
- The script accepts a whole-number value through --token-budget.
- The script prints a snippet only when its cumulative codeTokens total fits within the budget.
- Every accepted snippet includes its title plus library details plus source URL plus codeTokens value plus content.
Your lookup tool now controls how much documentation reaches a model. Next up, you will use those trimmed snippets to produce an answer that points back to real source URLs.
Verify a Model Answer
Your docs-ask script already trims Context7 Search documentation to a chosen token budget. Now you can test whether those snippets support a trustworthy coding answer.
In this step, you will pass the snippets into an AI model prompt. You will open every cited source to confirm the answer follows the retrieved documentation.
In this step, get ready to:
- Feed token-budgeted documentation snippets into a model prompt.
- Require a source URL for every factual coding claim.
- Audit every claim against an openable official documentation page.
Feed the snippets into a model
A grounded prompt gives the model a defined evidence packet. Your retrieved snippets provide that boundary.
- Switch back to the terminal from the previous step.
- Run docs-ask again using the same coding question plus the lower token budget from your previous comparison.
- Copy the complete output from that run.
- Start a new conversation in the model interface you use for coding questions.
- Enter the same coding question at the top of the prompt.
- Paste the copied snippet output below the question.
Your draft prompt now contains the question plus its documentation evidence.
What Makes This Prompt Grounded?
The retrieved snippets define which documentation the model can use. The budget controls how much evidence enters the model's context.
Each source URL makes the model's evidence visible. That trace is what turns the answer into something you can audit.
- Tell the model to answer using only the supplied snippets.
- Require a source URL immediately after every factual coding claim.
- Submit the prompt.
You should see a short coding answer with documentation URLs beside its factual claims.
Good progress. Your model answer now exposes the evidence trail you need for the audit.
Missing Source URLs?
- Ask the model to revise the answer with a source URL after each factual coding claim.
- Reduce the coding question to one method or task if the answer keeps drifting beyond the supplied snippets.
Get help tightening the model instructions.
Map each claim to a citation
A factual coding claim describes behavior that another developer could check. Each one needs a matching citation from your retrieved snippet set.
Which Statements Count as Claims?
- A method exists with a specific name.
- A method accepts a specific argument.
- A method returns a specific result.
- A task requires a specific setup step.
- Read the model answer one sentence at a time.
- Identify each sentence that makes a factual coding claim.
- Match each factual claim to the URL printed beside it.
- Compare each cited URL with the URLs in the copied docs-ask output.
- Flag every citation that does not appear in the retrieved output.
- Ask the model to rewrite each unmatched claim using only a retrieved source URL.
- Repeat the URL comparison until every citation comes from the retrieved output.
You should finish with a model answer whose citation URLs all appear in the documentation packet.
Citation Match Versus Claim Support
A citation match confirms that the model used a retrieved URL. Claim support confirms that the linked documentation says what the model wrote.
Both checks create an auditable answer.
Verify every source
Tracing a claim through a long documentation page can be fiddly because the supporting passage may sit inside a larger section. This final pass checks the documentation itself.
Before you begin the final pass, how many claims do you expect to survive unchanged?
- Open the source URL beside the first factual coding claim.
- Locate the documentation passage that supports the claim.
- Compare the model's claim with that passage.
- Check every remaining factual coding claim using the same process.
- Ask the model to remove or rewrite any unsupported claim.
- Repeat the source check after each revision.
You should be able to open every cited URL. Each surviving factual coding claim should match the documentation on its linked page.
That is the trust check complete. You now have a coding answer with an evidence trail that another developer can inspect.
Source Page Does Not Open?
- Rerun docs-ask for the same coding question to retrieve a current source set.
- Replace the stale snippet packet in your model prompt.
- Repeat the citation audit using the new URLs.
Get help auditing a citation that does not resolve.
Secret mission
Audit a Cross-Library Answer
Your sourced answer has already passed a link check. This mission raises the bar with a claim-by-claim citation audit. You will remove any claim its linked page cannot support.
Clean Up Your Resources
Clean Up Your Resources
Your lookup tool does not leave a server or billed cloud resource running. Choose whether to keep the local script, pause your work, or delete the script entirely.
Resources you used:
- The runnable docs-ask command-line script stored on your computer.
Keep everything running
No action is needed. Choose this option if you want to keep using your documentation lookup tool.
- Keep the docs-ask script in its current location for future coding questions.
- Use docs-ask when you need sourced snippets that fit within a token budget.
- Limit repeated unauthenticated requests because the Context7 Search endpoint applies an IP-based rate limit.
Pause - I'll come back to this later
There is no local server or background process to stop. Pausing leaves the script on disk without sending more requests to the search endpoint.
- Keep the docs-ask script in its current location.
- Close the terminal when you finish your current session.
- Return to the script whenever you want to continue testing different questions or token budgets.
Delete - I don't want to use this again
Remove the local script if you no longer want to use the lookup tool. This does not affect the external Context7 Search service.
- Switch back to the terminal from earlier.
- Move to the directory where you saved docs-ask.
- Delete the script by running this command:
rm docs-ask
This command removes only the docs-ask script from the current directory.
- View the same directory in Finder on macOS or File Explorer on Windows.
You should no longer see docs-ask in that directory. That clears the only project file created for this tool.
Still See the Script?
- Refresh the directory view before checking again.
- Confirm that your terminal was in the directory containing docs-ask when you ran the command.
- Get help deleting the script safely from your terminal.
Nice Work!
Nice Work!
Mission accomplished: your docs-ask command-line tool now retrieves official library documentation from Context7 Search within a token budget. You used those snippets to produce a model answer whose coding claims point back to openable source URLs.
You learned how to:
- Queried Context7 Search through its REST endpoint for coding questions. You compared returned library IDs across two libraries. You opened each source URL. You inspected each codeTokens value.
- Built a budget-aware CLI called docs-ask. It accepts a coding question. Its token-budget flag sets the cumulative limit. A lower budget produces a shorter snippet list.
- Created source-grounded model answers from trimmed documentation snippets. You verified every factual coding claim against an openable documentation URL.
- Secret Mission: Completed the optional challenge to extend the source-grounded docs-ask workflow.
Ready to quiz yourself?