Get Code Examples
get_code_examplesRetrieve working code examples for any library feature from official documentation, returning formatted fenced code blocks ready for immediate use.
Instructions
Fetch working code examples for a specific library feature from official docs.
Unlike get_docs(), this tool specifically hunts for pages rich in code samples, extracting and formatting fenced code blocks for immediate use.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Feature or pattern you need code for, e.g. "streaming chat completion", "async vector upsert", "RAG pipeline". | |
| library | Yes | Library key (e.g. "openai", "langchain", "pinecone"). | |
| language | No | Expected language for syntax context. Default: "python". | python |
| serper_api_key | No | Optional. Overrides server SERPER_API_KEY env var (BYOK). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |