Skip to main content
Glama

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 logic

  • FileAttachment(...) — use fetch/d3.csv/d3.json with the data URLs listed below the code

  • Imported helpers (e.g. Legend) — source notebook URLs are listed; fetch or inline as needed

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.3/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It discloses meaningful behavior beyond the schema: the code comes from Observable notebooks and may contain non-vanilla patterns, with concrete adaptation guidance for `invalidation`, `FileAttachment`, and imported helpers. It does not cover failure behavior for a bad path, but the substantive gotcha disclosure is strong.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loads the core action, then path format, then the discovery alternative, then adaptation notes. The adaptation bullet list is somewhat long but each bullet addresses a real portability pitfall, so it earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

An output schema exists, so return values need not be explained, and the description instead covers the path format and the Observable-to-vanilla adaptation caveats. Nearly complete; only invalid-path/error behavior is unaddressed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate, and it does: it gives the expected format with a concrete example ('@d3/bar-chart/2') including a version segment. This is far more useful than the bare string type in the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('Get D3.js example source code from an Observable notebook') and clearly distinguishes itself from search_docs/get_docs siblings. The agent can tell immediately this is a retrieval-by-path tool, not a discovery tool.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly routes discovery to a named alternative: 'Use find_example() to discover available examples,' which implies you must have a path before calling this. It does not state an explicit when-not-to-use case, but the dependency on a known path is clear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.