get_example
Retrieve D3.js example source code from an Observable notebook by path. Reuse the code to build or adapt charts, then replace Observable-specific patterns for vanilla D3.
Instructions
Get D3.js example source code from an Observable notebook.
Provide the example path (e.g. "@d3/bar-chart/2"). Use find_example() to discover available examples.
Code is extracted from Observable notebooks and may contain Observable-specific patterns. For vanilla D3, adapt these:
invalidation— remove or replace with cleanup logicFileAttachment(...)— use fetch/d3.csv/d3.json with the data URLs listed below the codeImported helpers (e.g.
Legend) — source notebook URLs are listed; fetch or inline as needed
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"path": "<path>"
},
"name": "get_example"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |