Skip to main content
Glama

get_vault_stats

Retrieve comprehensive statistics about your Obsidian vault to analyze content structure, track note counts, and monitor vault health metrics.

Instructions

Get statistics about the vault

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • MCP tool registration and handler function for 'get_vault_stats'. Retrieves vault statistics using ObsidianVault.get_vault_stats() and formats them for output.
    @mcp.tool(name="get_vault_stats", description="Get statistics about the vault") def get_vault_stats() -> str: """ Get statistics about the vault. Returns: Formatted vault statistics """ context = _get_context() try: stats = context.vault.get_vault_stats() output = "# Vault Statistics\n\n" output += f"**Total Notes:** {stats['total_notes']}\n" output += f"**Total Tags:** {stats['total_tags']}\n" output += f"**Total Size:** {stats['total_size_bytes']:,} bytes\n\n" if stats["unique_tags"]: output += "**Top Tags:**\n" for tag in stats["unique_tags"][:20]: output += f"- #{tag}\n" return output except Exception as e: logger.exception("Error getting vault stats") return f"Error getting vault stats: {e}"
  • Helper method in ObsidianVault class that computes the core vault statistics: total notes, total tags count, total size in bytes, and list of unique tags.
    def get_vault_stats(self) -> dict[str, Any]: """ Get statistics about the vault. Returns: Dict with vault statistics """ notes = self.list_notes(limit=100000, include_tags=True) tags = self.get_all_tags() total_size = sum(note.size for note in notes) return { "total_notes": len(notes), "total_tags": len(tags), "total_size_bytes": total_size, "unique_tags": sorted(tags.keys()), }

Latest Blog Posts

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/getglad/obsidian_mcp'

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