Get code examples from a Magic Lane documentation page
get_code_examplesExtract only the code blocks from a Magic Lane documentation page by URL or path, filtering by language tag or caption to skip the surrounding tutorial prose.
Instructions
Extract only the code blocks from a Magic Lane documentation page (by URL or /docs/... path), skipping the surrounding tutorial prose. Optionally filter by language tag (e.g. dart, kotlin, swift, cpp, typescript, json, shell) and by caption — the line that introduces a block, such as "Request Body" or "Response Body" on the REST API pages. Each block comes with its nearest heading and caption. Much cheaper than read_doc when only the sample code matters. Long pages are paged: the response says how many blocks remain and which offset continues; a block longer than the budget comes in parts. When a page has no matching block, the response names the languages it does have and the pages below it (or related pages, or for an example page the guides on its topic) that hold such blocks, with counts — listed unchecked when the page contents cannot be loaded, and not at all, saying so, when the index cannot be loaded in time.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | Absolute developer.magiclane.com URL or a /docs/... path of the page. | |
| offset | No | Skip this many matching blocks (for paging through pages with many examples). A block longer than maxChars is split into parts, and each part counts as one block here. | |
| caption | No | Only return blocks whose caption — the label line introducing the block, e.g. "Request Body" or "Response Body (error code 200)" — contains this text (case-insensitive). Only labelled blocks match: on the REST API pages caption: "request" keeps the labelled request bodies; a request body that follows a field list without a label is not found this way. | |
| language | No | Only return blocks with this language tag (aliases like ts/kt/c++/yml are honoured). | |
| maxChars | No | Character budget for the returned code (default 24000, at most 50000). A longer block is returned in parts. |