Read Fenced Block
blocks.readRead a fenced block's source and language-specific metadata from an Obsidian note. Locate by stable blockId or index within a language group; returns Mermaid directives or Dataview DQL metadata.
Instructions
Read one fenced block's source and language-specific metadata. Locate the block by blockId (preferred, stable) or index (0-based within the language group in the file; defaults to 0). language is required so the tool can dispatch to the correct parser and return the right metadata (Mermaid directives, Dataview DQL parts, etc.). Fails with not_found when no block matches the locator. Read-only.
Operates on the session-active vault (see vault.current — selectable via vault.select) unless an explicit vaultPath argument is passed, which always wins.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| index | No | 0-based position of the block within its language group in the file. Use when no blockId is available. Defaults to 0 (the first block). | |
| blockId | No | Stable block identifier (e.g. `^abc123`). Takes precedence over `index` when both are given. | |
| filePath | Yes | Path of the note containing the block. | |
| language | Yes | Language of the block to read (required so `blocks.read` can dispatch to the correct parser). | |
| vaultPath | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | ||
| source | Yes | The block's body source (without fences). | |
| filePath | Yes | ||
| language | Yes | Fenced-code-block language. `dataview` = raw DQL query block; `dataviewjs` = inline JavaScript block; `mermaid` = diagram block. |