obsidian_get_backlinks
List all notes that link to a target note, showing line numbers and raw link targets.
Instructions
List notes that link to a target note, with line numbers and raw link targets.
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": "obsidian_get_backlinks"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| vault | No | Optional configured vault name. Defaults to the server default vault. | |
| path | Yes | Vault-relative path. Absolute paths and traversal are rejected. |
Implementation Reference
- src/tools.ts:743-749 (handler)Handler for the obsidian_get_backlinks tool. It loads all notes, builds the graph, and calls the backlinks() function.
tool( "obsidian_get_backlinks", "List notes that link to a target note, with line numbers and raw link targets.", { vault: vaultArg, path: pathArg }, async (args) => ({ backlinks: backlinks(buildGraph(await loadNotes(vaults, args.vault)), args.path) }), { readOnlyHint: true }, ); - src/tools.ts:746-746 (schema)Input schema for the tool: optional vault name and required vault-relative path.
{ vault: vaultArg, path: pathArg }, - src/tools.ts:743-749 (registration)Registration of the obsidian_get_backlinks tool via the local tool() helper which wraps McpServer.tool().
tool( "obsidian_get_backlinks", "List notes that link to a target note, with line numbers and raw link targets.", { vault: vaultArg, path: pathArg }, async (args) => ({ backlinks: backlinks(buildGraph(await loadNotes(vaults, args.vault)), args.path) }), { readOnlyHint: true }, ); - src/graph.ts:67-71 (helper)The backlinks() helper function that filters graph edges for resolved inbound links to the target node.
export function backlinks(graph: VaultGraph, targetPath: string): GraphEdge[] { const target = resolveGraphPath(graph, targetPath); if (!target) return []; return graph.edges.filter((edge) => !edge.unresolved && edge.target === target.path); }