{"uid":"cap_54xI6yqNMTpmOxmIt9FQh","slug":"agentstools-dev-docs-snippet-048e47ab","name":"agentstools.dev Docs Snippet","description":"Working code snippets for a library, matched to a topic. Give an ecosystem, package name and a topic or symbol and get the fenced code blocks from the README or docs whose language, code or nearest heading matches, each with a source citation and an honest truncated flag. Ideal for grounding a coding agent in real usage examples.","url":"https://api.agentstools.dev/docs/snippet","method":"GET","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method"],"properties":{"type":{"type":"string","const":"http"},"method":{"enum":["GET","HEAD","DELETE"],"type":"string"},"queryParams":{"type":"object","required":["name","ecosystem"],"properties":{"name":{"type":"string","description":"Package name; for github pass owner/repo such as coinbase/x402. npm scoped names @scope/name are allowed."},"topic":{"type":"string","description":"Optional topic or symbol; matched against the README/llms.txt markdown headings, such as authentication or useEffect."},"symbol":{"type":"string","description":"Optional symbol name to match, an alias for topic."},"version":{"type":"string","description":"Optional exact version to pin, such as 2.31.0; default is latest."},"ecosystem":{"enum":["npm","pypi","crates","github"],"type":"string","description":"Package ecosystem. Aliases accepted: pip and python map to pypi; cargo and rust map to crates; node maps to npm; gh maps to github."}}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object"}}}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.008","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.008/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.008","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.008","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_1fU1PQ2Ur3cHWXHPffuli","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.008","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Retrieves matching fenced code blocks from a package's README or docs given an ecosystem, package name, and optional topic or symbol","exampleAgentPrompt":"Can you pull the code snippets from the coinbase/x402 GitHub repo's README that match 'authentication' — I need real working examples to ground my implementation.","exampleUseCases":null,"resultDescription":"Returns an array of fenced code blocks from the package's README or docs whose language, code, or nearest heading matches the requested topic or symbol. Each block includes the code content, the source URL/citation, the detected language, and an honest truncated flag indicating whether the block was cut off.","failureModes":["Package not found in the specified ecosystem — returns an error or empty results","Topic/symbol not found in any heading or code block — returns empty snippet array","Invalid ecosystem value — returns a validation error","Version not found or not yet indexed — returns an error or falls back to latest","Rate limit or payment failure (x402) — returns 402 Payment Required","Network timeout fetching upstream docs — returns a 5xx error"],"whenToPreferThis":"Use this endpoint when you need to ground a coding agent in real, verified usage examples from a package's actual documentation rather than relying on training data that may be stale. Especially useful for pinning to a specific version, looking up niche symbols, or when hallucination risk on library APIs is high. Prefer this over generic web search when you want structured, citation-backed code blocks rather than raw HTML or prose.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-14T06:38:28.030Z","isFirstParty":false}