Skip to main content
Glama

Obsidian MCP

by takuya0206

searchWithJsonLogic

Filter and search Obsidian notes programmatically using JsonLogic queries. Apply structured logical conditions to metadata and content for precise, advanced searches.

Instructions

Search Obsidian notes using JsonLogic format queries. Using logical conditions expressed in JSON, you can flexibly filter note metadata and content. Suitable for programmatically generated searches, allowing complex conditions to be expressed in a structured way.

Input Schema

NameRequiredDescriptionDefault
queryYesJsonLogic query object. Express logical conditions in JSON format for advanced note searching. Basic Concept: JsonLogic is a specification for expressing logical conditions in JSON format. Each condition is expressed in the form {"operator": [arg1, arg2, ...]}. In Obsidian search, you can specify conditions for note metadata fields. Main Operators: 1. Common comparison operators: - "==", "===": Equality (e.g., {"==": [{"var": "rating"}, 5]}) - "!=", "!==": Inequality - ">", ">=", "<", "<=": Magnitude comparison 2. Logical operators: - "and": All conditions are true (e.g., {"and": [condition1, condition2]}) - "or": At least one condition is true - "!": Negation of a condition 3. Obsidian-specific operators: - "glob": Glob pattern matching (e.g., {"glob": [{"var": "file.path"}, "*.md"]}) - "regexp": Regular expression matching (e.g., {"regexp": ["^task.*", {"var": "file.name"}]}) 4. Data access: - "var": Get the value of a field (e.g., {"var": "frontmatter.tags"}) Basic Structure: { "operator": [ {"var": "field name"}, comparison value ] } Or compound conditions: { "and/or": [ {condition1}, {condition2}, ... ] } Usage Examples: 1. Search for notes with a specific tag: { "in": ["project", {"var": "tags"}] } 2. Search for notes where a specific frontmatter field equals a specific value: { "==": [{"var": "frontmatter.status"}, "in progress"] } 3. Search for notes with a specific URL pattern: { "glob": [{"var": "frontmatter.url"}, "https://example.com/*"] } 4. Combination of multiple conditions - notes with a specific tag and due date before today: { "and": [ {"in": ["task", {"var": "tags"}]}, {"<=": [{"var": "frontmatter.due"}, "2023-12-31"]} ] } 5. Complex example - notes in a specific folder and having a specific status or matching a specific URL pattern: { "and": [ {"glob": [{"var": "file.path"}, "projects/*"]}, {"or": [ {"==": [{"var": "frontmatter.status"}, "important"]}, {"glob": [{"var": "frontmatter.url"}, "https://github.com/*"]} ]} ] } Notes: - Field names specified with "var" must match the actual metadata structure of notes - If a field doesn't exist, the condition is not ignored but evaluated as false - Date comparisons are treated as strings, so using ISO format (YYYY-MM-DD) is safest - File properties include file.path, file.name, file.size, file.ctime, file.mtime, etc. - Frontmatter fields can be accessed with frontmatter.fieldname - The "in" operator is useful for array-type fields (such as tags)

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "query": { "additionalProperties": {}, "description": "JsonLogic query object. Express logical conditions in JSON format for advanced note searching.\n\nBasic Concept:\nJsonLogic is a specification for expressing logical conditions in JSON format. Each condition is expressed in the form {\"operator\": [arg1, arg2, ...]}.\nIn Obsidian search, you can specify conditions for note metadata fields.\n\nMain Operators:\n1. Common comparison operators:\n - \"==\", \"===\": Equality (e.g., {\"==\": [{\"var\": \"rating\"}, 5]})\n - \"!=\", \"!==\": Inequality\n - \">\", \">=\", \"<\", \"<=\": Magnitude comparison\n\n2. Logical operators:\n - \"and\": All conditions are true (e.g., {\"and\": [condition1, condition2]})\n - \"or\": At least one condition is true\n - \"!\": Negation of a condition\n\n3. Obsidian-specific operators:\n - \"glob\": Glob pattern matching (e.g., {\"glob\": [{\"var\": \"file.path\"}, \"*.md\"]})\n - \"regexp\": Regular expression matching (e.g., {\"regexp\": [\"^task.*\", {\"var\": \"file.name\"}]})\n\n4. Data access:\n - \"var\": Get the value of a field (e.g., {\"var\": \"frontmatter.tags\"})\n\nBasic Structure:\n{\n \"operator\": [\n {\"var\": \"field name\"},\n comparison value\n ]\n}\n\nOr compound conditions:\n{\n \"and/or\": [\n {condition1},\n {condition2},\n ...\n ]\n}\n\nUsage Examples:\n1. Search for notes with a specific tag:\n {\n \"in\": [\"project\", {\"var\": \"tags\"}]\n }\n\n2. Search for notes where a specific frontmatter field equals a specific value:\n {\n \"==\": [{\"var\": \"frontmatter.status\"}, \"in progress\"]\n }\n\n3. Search for notes with a specific URL pattern:\n {\n \"glob\": [{\"var\": \"frontmatter.url\"}, \"https://example.com/*\"]\n }\n\n4. Combination of multiple conditions - notes with a specific tag and due date before today:\n {\n \"and\": [\n {\"in\": [\"task\", {\"var\": \"tags\"}]},\n {\"<=\": [{\"var\": \"frontmatter.due\"}, \"2023-12-31\"]}\n ]\n }\n\n5. Complex example - notes in a specific folder and having a specific status or matching a specific URL pattern:\n {\n \"and\": [\n {\"glob\": [{\"var\": \"file.path\"}, \"projects/*\"]},\n {\"or\": [\n {\"==\": [{\"var\": \"frontmatter.status\"}, \"important\"]},\n {\"glob\": [{\"var\": \"frontmatter.url\"}, \"https://github.com/*\"]}\n ]}\n ]\n }\n\nNotes:\n- Field names specified with \"var\" must match the actual metadata structure of notes\n- If a field doesn't exist, the condition is not ignored but evaluated as false\n- Date comparisons are treated as strings, so using ISO format (YYYY-MM-DD) is safest\n- File properties include file.path, file.name, file.size, file.ctime, file.mtime, etc.\n- Frontmatter fields can be accessed with frontmatter.fieldname\n- The \"in\" operator is useful for array-type fields (such as tags)", "type": "object" } }, "required": [ "query" ], "type": "object" }
Install Server

Other Tools from Obsidian MCP

Related Tools

    MCP directory API

    We provide all the information about MCP servers via our MCP API.

    curl -X GET 'https://glama.ai/api/mcp/v1/servers/takuya0206/obsidian-mcp'

    If you have feedback or need assistance with the MCP directory API, please join our Discord server