Disable a plugin
obsidian_disable_pluginDisable a community plugin in an Obsidian vault by its ID for programmatic plugin management.
Instructions
Disables a community plugin by id.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| vault | No | Vault name to target. Optional — defaults to the most recently focused vault. | |
| id | Yes |
Implementation Reference
- src/tools.ts:737-738 (handler)Handler function for obsidian_disable_plugin — calls runText('plugin:disable', ...) which executes the Obsidian CLI 'plugin:disable' command with vault and plugin id.
handler: async ({ vault, id }) => runText("plugin:disable", { vault, params: { id } }), - src/tools.ts:732-735 (schema)Input schema for obsidian_disable_plugin — accepts 'vault' (optional string) and 'id' (required string) for the plugin identifier.
inputSchema: { ...VaultArg, id: z.string().min(1), }, - src/tools.ts:728-739 (registration)Tool definition registration for obsidian_disable_plugin in the tools array. It has name 'obsidian_disable_plugin', title 'Disable a plugin', description, inputSchema, annotations (readOnlyHint: false, idempotentHint: true), and a handler. No confirm prompt (unlike enable_plugin).
{ name: "obsidian_disable_plugin", title: "Disable a plugin", description: "Disables a community plugin by id.", inputSchema: { ...VaultArg, id: z.string().min(1), }, annotations: { readOnlyHint: false, idempotentHint: true }, handler: async ({ vault, id }) => runText("plugin:disable", { vault, params: { id } }), }, - src/tools.ts:99-110 (helper)The runText helper function that executes Obsidian CLI commands via runObsidian and returns text results. Used by the plugin:disable handler.
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-104 (helper)The runObsidian function that builds and executes the CLI command. It constructs the command-line arguments, invokes the 'obsidian' binary (or OBSIDIAN_CLI env var) and returns stdout/stderr.
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, ); } }