Show CLI help
obsidian_helpDisplays the raw Obsidian CLI help output to diagnose unexpected command behavior. Optionally includes hidden commands with --all.
Instructions
Shows the underlying obsidian help output — useful when a command behaves unexpectedly.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| all | No | Pass --all to include hidden commands. |
Implementation Reference
- src/tools.ts:823-834 (handler)The handler function for the obsidian_help tool. It calls runText('help', ...) with optional --all flag passed via flags array.
{ name: "obsidian_help", title: "Show CLI help", description: "Shows the underlying `obsidian help` output — useful when a command behaves unexpectedly.", inputSchema: { all: z.boolean().optional().describe("Pass --all to include hidden commands."), }, annotations: { readOnlyHint: true, openWorldHint: false }, handler: async ({ all }) => runText("help", { flags: all ? ["--all"] : [] }), }, - src/tools.ts:828-830 (schema)Input schema for obsidian_help: optional boolean 'all' parameter to include hidden commands.
inputSchema: { all: z.boolean().optional().describe("Pass --all to include hidden commands."), }, - src/tools.ts:99-110 (helper)runText helper function that wraps runObsidian and formats stdout/stderr into an MCP text result.
async function runText( command: string, opts: Parameters<typeof runObsidian>[1] = {}, ): Promise<McpToolResult> { try { const result = await runObsidian(command, opts); const text = result.stdout.trim() || result.stderr.trim() || "(no output)"; return textResult(text); } catch (err) { return errorResult(err); } } - src/exec.ts:64-102 (helper)runObsidian function that executes the 'obsidian' CLI binary with the built args. The actual execution of `obsidian help ...`.
export async function runObsidian( command: string, opts: RunOptions = {}, ): Promise<RunResult> { const bin = process.env.OBSIDIAN_CLI ?? "obsidian"; const args = buildArgs(command, opts); const cmdline = [bin, ...args].map(shellQuote).join(" "); try { const { stdout, stderr } = await exec(cmdline, { maxBuffer: 64 * 1024 * 1024, windowsHide: true, }); return { stdout, stderr, exitCode: 0, command: cmdline }; } catch (err: unknown) { const e = err as NodeJS.ErrnoException & { stdout?: string; stderr?: string; code?: number | string; }; const result: RunResult = { stdout: e.stdout ?? "", stderr: e.stderr ?? e.message ?? "", exitCode: typeof e.code === "number" ? e.code : 1, command: cmdline, }; if (e.code === "ENOENT") { throw new ObsidianCliError( `Obsidian CLI binary not found ('${bin}'). ` + `Make sure Obsidian is running and the CLI is registered ` + `(Settings → General → Command line interface → Register CLI). ` + `Override with the OBSIDIAN_CLI env var if the binary lives elsewhere.`, result, ); } throw new ObsidianCliError( `obsidian CLI exited with code ${result.exitCode}: ${result.stderr.trim() || result.stdout.trim()}`, result, ); - src/tools.ts:814-835 (registration)The tool definition object registered in the tools array with name 'obsidian_help', along with 'obsidian_version' in the meta section.
// ---------- meta ---------- { name: "obsidian_version", title: "Get Obsidian CLI version", description: "Returns the version of the Obsidian CLI binary in use.", inputSchema: {}, annotations: { readOnlyHint: true, openWorldHint: false }, handler: async () => runText("version"), }, { name: "obsidian_help", title: "Show CLI help", description: "Shows the underlying `obsidian help` output — useful when a command behaves unexpectedly.", inputSchema: { all: z.boolean().optional().describe("Pass --all to include hidden commands."), }, annotations: { readOnlyHint: true, openWorldHint: false }, handler: async ({ all }) => runText("help", { flags: all ? ["--all"] : [] }), }, ];