Search Obsidian vault via DQL and JsonLogic
Search your Obsidian vault using Dataview DQL TABLE queries or JsonLogic expressions via the Local REST API. Use when you need to query notes from the command line or build automation workflows that integrate with Obsidian.
/plugin marketplace add dnvriend/obsidian-search-tool/plugin install obsidian-search-tool@obsidian-search-toolThis skill inherits all available tools. When active, it can use any tool Claude has access to.
A professional CLI tool for searching an Obsidian vault through the Obsidian Local REST API using Dataview Query Language (DQL) TABLE queries and JsonLogic queries. Enables programmatic access to Obsidian notes for automation, scripting, and integration workflows.
Use this skill when:
Do NOT use this skill for:
Python CLI tool (version 0.1.0) that interfaces with Obsidian's Local REST API plugin to perform searches using Dataview Query Language and JsonLogic.
# Clone repository
git clone https://github.com/dnvriend/obsidian-search-tool.git
cd obsidian-search-tool
# Install with uv
uv tool install .
# Or install from source
uv sync
uv tool install . --reinstall
# Set API key (get from Obsidian → Settings → Community Plugins → Local REST API)
export OBSIDIAN_API_KEY="your-api-key-here"
# Check API connectivity
obsidian-search-tool status
# Validate authentication
obsidian-search-tool auth
# Search with Dataview DQL
obsidian-search-tool search 'TABLE file.name FROM "daily" LIMIT 5'
# Search with JsonLogic
obsidian-search-tool search --type jsonlogic '{"in": ["keyword", {"var": "content"}]}'
Verifies that the Obsidian Local REST API is reachable and responding. Use this to debug connection issues before performing searches.
Usage:
obsidian-search-tool status [OPTIONS]
Options:
--json: JSON output (default, machine-readable)--text / -t: Markdown-formatted text output-v: INFO level logging (operation status)-vv: DEBUG level logging (detailed operations)-vvv: TRACE level logging (full HTTP details + library internals)Examples:
# Basic status check with JSON output
obsidian-search-tool status
# Human-readable text output
obsidian-search-tool status --text
# With verbose logging for debugging
obsidian-search-tool status -vv
# Trace mode with urllib3 logging
obsidian-search-tool status -vvv
Output (JSON):
{
"success": true,
"data": {
"status": "connected",
"api_url": "http://127.0.0.1:27123",
"timestamp": "2025-11-21T10:00:00+00:00",
"message": "API is reachable"
}
}
Common Errors:
Connection failed: Obsidian not running or plugin disabledOBSIDIAN_API_KEY environment variable is required: API key not setRequest timeout: Increase OBSIDIAN_TIMEOUT or check networkVerifies that the API key is valid and authentication is working correctly. Use this to test your OBSIDIAN_API_KEY before performing searches.
Usage:
obsidian-search-tool auth [OPTIONS]
Options:
--json: JSON output (default)--text / -t: Markdown-formatted text output-v/-vv/-vvv: Verbosity levels (INFO/DEBUG/TRACE)Examples:
# Basic auth check
obsidian-search-tool auth
# With text output
obsidian-search-tool auth --text
# With debug logging
obsidian-search-tool auth -vv
Output (JSON):
{
"success": true,
"data": {
"status": "authenticated",
"api_url": "http://127.0.0.1:27123",
"timestamp": "2025-11-21T10:00:00+00:00",
"message": "Authentication is valid"
}
}
Getting Your API Key:
export OBSIDIAN_API_KEY="your-key"Search Obsidian vault using Dataview DQL TABLE queries or JsonLogic queries.
Usage:
obsidian-search-tool search QUERY [OPTIONS]
obsidian-search-tool search --stdin [OPTIONS]
Arguments:
QUERY: Search query string (required unless --stdin)--type: Query type - dataview (default) or jsonlogic--stdin / -s: Read query from stdin (mutually exclusive with positional query)--json: JSON output (default, machine-readable)--text / -t: Markdown-formatted text output--table: Pretty-printed table output (best for TABLE results)-v/-vv/-vvv: Verbosity levels (INFO/DEBUG/TRACE)Dataview DQL Examples:
# Basic TABLE query with FROM
obsidian-search-tool search 'TABLE file.name FROM "daily" LIMIT 5'
# Recent notes with date functions
obsidian-search-tool search 'TABLE file.name, file.mtime WHERE file.mtime >= date(today) - dur(7 days) SORT file.mtime DESC'
# Folder filtering with contains()
obsidian-search-tool search 'TABLE file.name, file.folder WHERE contains(file.folder, "reference")'
# Large files sorted by size
obsidian-search-tool search 'TABLE file.name, file.size WHERE file.size > 10000 SORT file.size DESC LIMIT 10'
# Complex multi-condition query
obsidian-search-tool search 'TABLE file.name FROM "docs" WHERE file.size > 5000 AND file.mtime >= date(today) - dur(30 days)'
JsonLogic Examples:
# Content search
obsidian-search-tool search --type jsonlogic '{"in": ["Claude", {"var": "content"}]}'
# Filename contains
obsidian-search-tool search --type jsonlogic '{"in": ["daily", {"var": "filename"}]}'
# Tag search
obsidian-search-tool search --type jsonlogic '{"in": [{"var": "frontmatter.tags"}, "aws"]}'
Output Formats:
# JSON output (default, for scripting)
obsidian-search-tool search 'TABLE file.name'
# Markdown text output (human-readable)
obsidian-search-tool search 'TABLE file.name' --text
# Pretty table output (best for TABLE results)
obsidian-search-tool search 'TABLE file.name, file.size' --table
Stdin Input:
# Read query from stdin (useful for piping)
echo 'TABLE file.name FROM #meeting' | obsidian-search-tool search --stdin
# From file
cat query.txt | obsidian-search-tool search --stdin
Output (JSON):
{
"success": true,
"data": {
"query": "TABLE file.name FROM \"daily\" LIMIT 5",
"search_type": "dataview",
"timestamp": "2025-11-21T10:00:00+00:00",
"results": [
{"filename": "daily/2025-11/2025-11-21.md", "result": true},
{"filename": "daily/2025-11/2025-11-20.md", "result": true}
]
}
}
Generate shell completion scripts for bash, zsh, or fish to enable tab completion.
Usage:
obsidian-search-tool completion SHELL
Arguments:
SHELL: Shell type (bash, zsh, or fish)Installation Examples:
# Bash (temporary - current session)
eval "$(obsidian-search-tool completion bash)"
# Bash (permanent)
echo 'eval "$(obsidian-search-tool completion bash)"' >> ~/.bashrc
source ~/.bashrc
# Zsh (permanent)
echo 'eval "$(obsidian-search-tool completion zsh)"' >> ~/.zshrc
source ~/.zshrc
# Fish (persistent)
mkdir -p ~/.config/fish/completions
obsidian-search-tool completion fish > ~/.config/fish/completions/obsidian-search-tool.fish
What Gets Completed:
status, auth, search, completion--json, --text, --table, --verbose, -v, -vv, -vvv--type dataview|jsonlogic, bash|zsh|fishCommands refine query results and execute in order:
FROM - Select source pages (tags, folders, files, links)
FROM #tag # By tag (includes subtags)
FROM "folder" # By folder (includes subfolders)
FROM [[note]] # Pages linking TO note
FROM outgoing([[note]]) # Pages linked FROM note
WHERE - Filter pages based on conditions
WHERE file.size > 1000 # Comparison
WHERE contains(file.folder, "ai-ml") # Contains check
WHERE file.mtime >= date(today) - dur(7 days) # Date-based
SORT - Sort results by one or more fields
SORT file.mtime DESC # Single field
SORT file.folder ASC, file.mtime DESC # Multiple fields
LIMIT - Restrict result count
LIMIT 10 # Top 10 results
Not Supported:
All pages have automatic metadata:
file.name, file.path, file.folder, file.size, file.extfile.ctime, file.mtime, file.cday, file.mdayfile.tags, file.etags, file.inlinks, file.outlinksfile.tasks, file.lists, file.frontmatterdate(), dur(), list(), link()round(), min(), max(), sum(), length()contains(), lower(), upper(), split(), replace()all(), any(), none(), choice(), default()dateformat(), striptime()filename: File path relative to vault rootfrontmatter.*: YAML frontmatter fields (e.g., frontmatter.tags)content: Full file content (for text search)in: Substring/membership check (works reliably)and, or, not==, !=, <, >, <=, >=startsWith/endsWith: Not supported by API (returns "Unrecognized operation")in operator for substring matching insteadProgressive logging detail control:
-v: INFO level - operation status, high-level events-vv: DEBUG level - detailed operations, API calls, validation-vvv: TRACE level - full HTTP requests, urllib3 internals, tracebacksExamples:
# Quiet mode (warnings only)
obsidian-search-tool status
# Verbose mode (operations)
obsidian-search-tool search 'TABLE file.name' -v
# Debug mode (API details)
obsidian-search-tool search 'TABLE file.name' -vv
# Trace mode (HTTP internals)
obsidian-search-tool search 'TABLE file.name' -vvv
OBSIDIAN_API_KEY (required): API token from plugin settingsOBSIDIAN_BASE_URL (optional): API URL (default: http://127.0.0.1:27123)OBSIDIAN_TIMEOUT (optional): Request timeout in seconds (default: 30)JSON output goes to stdout, logs to stderr for clean piping:
# Pipe to jq for processing
obsidian-search-tool search 'TABLE file.name' --json | jq '.data.results[].filename'
# Count results
obsidian-search-tool search 'TABLE file.name' --json | jq '.data.results | length'
# Extract specific fields
obsidian-search-tool search 'TABLE file.name, file.size' --json | jq '.data.results[] | select(.file.size > 10000)'
</details>
<details>
<summary><strong>🔧 Troubleshooting (Click to expand)</strong></summary>
Issue: "OBSIDIAN_API_KEY environment variable is required"
# Symptom
Error: OBSIDIAN_API_KEY environment variable is required
Solution:
export OBSIDIAN_API_KEY="your-key-here"Issue: "Connection failed to http://127.0.0.1:27123"
# Symptom
ConnectionRefusedError: [Errno 61] Connection refused
Solution:
Issue: "Only TABLE dataview queries are supported"
# Symptom
Error: Only TABLE dataview queries are supported
Solution:
TABLE file.name FROM #tag instead of LIST FROM #tagIssue: "TABLE WITHOUT ID queries are not supported"
# Symptom
Error: TABLE WITHOUT ID queries are not supported
Solution:
WHERE contains(file.folder, "reference") instead of GROUP BYIssue: "Unrecognized operation startsWith"
# Symptom with JsonLogic
Error: Unrecognized operation startsWith
Solution:
in operator for substring matching{"in": ["prefix", {"var": "filename"}]} instead of startsWithIssue: No results found but files exist
Solution:
FROM "folder" not FROM folder# Main help
obsidian-search-tool --help
# Command-specific help
obsidian-search-tool status --help
obsidian-search-tool auth --help
obsidian-search-tool search --help
obsidian-search-tool completion --help
# Version info
obsidian-search-tool --version
obsidian-search-tool status -vvobsidian-search-tool auth -vvobsidian-search-tool search 'TABLE file.name LIMIT 1' -vv0: Success1: Client error (authentication, connection, API error)2-255: Other errorsJSON (default):
Text (--text):
Table (--table):
status and auth first-v, escalate to -vv for debugging--json | jq for processing results--stdin