Skip to main content
Glama
Obsidian CDP MCP Server

Obsidian CDP MCP Server

obsidian_eval

Executes custom JavaScript in Obsidian with full API access to handle complex queries and automation workflows beyond built-in tools.

Instructions

Execute JavaScript code in Obsidian with full API access.

WHEN TO USE:

  • Operations not covered by other tools

  • Complex queries combining multiple APIs

  • Custom automation workflows

COMMON PATTERNS:

  • Get active file: app.workspace.getActiveFile()

  • Read file: await app.vault.read(file)

  • Modify file: await app.vault.modify(file, content)

  • Get metadata: app.metadataCache.getFileCache(file)

  • Execute command: app.commands.executeCommandById('cmd-id')

  • Access plugin: app.plugins.plugins['plugin-id']

NOTE: Code runs in Obsidian's context. Use 'return' for values. Promises are auto-awaited.

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": {
      "code": "<code>"
    },
    "name": "obsidian_eval"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeYesJavaScript code to execute. Use `app` to access Obsidian API.
await_promiseNoWait for promise to resolve if code returns a promise (default: true)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.9.2

TDQS

A4/5.0
Behavior3/5

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

No annotations are supplied, so the description carries the full behavioral burden. It does disclose valuable execution semantics — 'Code runs in Obsidian's context', use 'return' for values, promises auto-awaited — but for arbitrary code execution with full vault-write API access it never states that changes are immediate and irreversible, nor anything about errors, timeouts, or sandbox limits.

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-loaded with the core statement, then cleanly sectioned into WHEN TO USE, COMMON PATTERNS, and NOTE. The pattern list is six lines long but each is a distinct, non-redundant API example; only marginal trimming is possible.

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

Completeness3/5

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

No output schema and no annotations mean the description must cover execution behavior, which it partially does via return-value and promise conventions. However, for a tool that can mutate or delete vault content through the full API, the absence of any warning about side effects or failure modes leaves a meaningful gap.

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 coverage is already 100%, and the description still adds real meaning: the 'app' binding used by the code parameter is demonstrated across six patterns, and 'Use return for values' plus 'Promises are auto-awaited' explain the practical effect of the await_promise flag. That goes beyond the schema's bare 'Wait for promise to resolve' wording.

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 ('Execute JavaScript code in Obsidian') with an explicit scope qualifier ('full API access'). The WHEN TO USE section immediately distinguishes it from the sibling read/write/command tools by framing it as the escape hatch for 'Operations not covered by other tools'.

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?

Gives three concrete use conditions and implicitly routes the agent away from this tool when a dedicated sibling exists ('not covered by other tools'). It stops short of naming specific siblings to prefer or giving an explicit when-not case, so the routing rule is directional but not fully enumerated.

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