{"uid":"cap_JcUrKOfdolE-fcGDp1oi5","slug":"docs-snippet-b9ad54e1","name":"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://payai.agentstools.dev/docs/snippet?utm_source=zero.xyz","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_hA0y4mSk9KavdG-MSfPs9","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 for a given topic or symbol, with source citations and truncation flags.","exampleAgentPrompt":"Can you grab a working code snippet from the npm package axios docs that shows how to set up request interceptors? I want a real example I can paste into my project.","exampleUseCases":[{"title":"Bootstrap auth in a new project","prompt":"Find me a code example from the coinbase/x402 GitHub repo that shows how to authenticate — I want to see how it's done in real usage, not just the docs description."},{"title":"Learn Rust async with tokio","prompt":"Pull a working code snippet from the tokio crate on crates.io that demonstrates how to use async tasks — matched to the 'spawn' symbol if possible."},{"title":"Onboard to a Python ML library","prompt":"Get me a fenced code block from the scikit-learn pypi package docs that covers fitting a model, something matched to the 'fit' topic so I can see a real example."}],"resultDescription":"A list of fenced code blocks extracted from the package's README or documentation, each including the code content, the programming language, the nearest heading or section it came from, a source URL or citation, and a boolean flag indicating if the block was truncated.","failureModes":["Package not found in the specified ecosystem — returns empty results or 404-like response","Topic or symbol does not match any heading or code block in the docs — returns empty snippet list","Requested version does not exist or is not indexed — falls back to latest or returns error","README/docs are not structured enough to extract fenced code blocks — returns empty list","Ecosystem alias not recognized if misspelled beyond supported aliases"],"whenToPreferThis":"Use this endpoint when a coding agent needs to ground itself in real, cited usage examples from a package's actual README or documentation rather than hallucinating syntax. It is ideal when you know the package name and a specific topic or symbol and need working code to paste or adapt, especially across npm, pypi, crates, and GitHub repos. Prefer this over general web search when you want structured, language-tagged code blocks with source citations and truncation honesty signals.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-11T00:42:02.723Z","isFirstParty":false,"canonicalSlug":"docs-snippet-b9ad54e1"}