Two possibilities come to my mind:
- Use a plugin that converts your dataview queries in actual markdown, so that the MCP can read the markdown contents. For example, DataView Serializer or DataView Publisher.
- Use my fork of mcp-obsidian which, in combination with obsidian-local-rest-api can run dataview queries and retrieve the results.
Some notes about the 2nd approach:
- The capability of running dataview queries through the rest api was already in the rest api, but the original implementation of mcp-obsidian did not take advantage of it, that’s why I did a fork. I also did a PR so perhaps this functionality ends up in the main mcp-obsidian repo.
- Not all kind of dataview queries are supported, only
TABLE
ones. The local rest api plugin do not implement TASK, LIST or CALENDAR queries. Also, it rejects TABLE WITHOUT ID queries. - The LLM should be smart enough to detect that the contents of a note he retrieved via MCP contains a dataview query, and that this requires another mcp call to run that query and get the results. I guess most LLMs would be smart enough for this.