Skip to main content
Glama

get_vault_info

Retrieve details about an Obsidian vault, including its structure and metadata, by providing the vault's file path.

Instructions

Get information about a specific vault

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
vault_pathYesPath to the Obsidian vault

Implementation Reference

  • The main handler function that executes the tool logic: fetches vault stats from VaultManager and returns formatted information including note count, size, etc.
    export async function handleGetVaultInfo( vaultManager: VaultManager, vaultPath: string ) { const stats = await vaultManager.getVaultStats(vaultPath); return { path: stats.path, name: stats.name, noteCount: stats.noteCount, totalSize: stats.size, lastModified: stats.lastModified, sizeFormatted: formatBytes(stats.size || 0), }; }
  • Input schema defining the required 'vault_path' parameter for the tool.
    inputSchema: { type: 'object', properties: { vault_path: { type: 'string', description: 'Path to the Obsidian vault', }, }, required: ['vault_path'], },
  • src/index.ts:44-57 (registration)
    Tool definition registered in the TOOLS array for the list_tools MCP request.
    { name: 'get_vault_info', description: 'Get information about a specific vault', inputSchema: { type: 'object', properties: { vault_path: { type: 'string', description: 'Path to the Obsidian vault', }, }, required: ['vault_path'], }, },
  • src/index.ts:176-181 (registration)
    Dispatch logic in the call_tool handler that invokes the get_vault_info tool implementation.
    case 'get_vault_info': if (!args || typeof args !== 'object' || !('vault_path' in args)) { throw new McpError(ErrorCode.InvalidParams, 'Missing vault_path'); } result = await handleGetVaultInfo(vaultManager, args.vault_path as string); break;
  • Helper function used by the handler to format the total size of the vault into human-readable bytes.
    function formatBytes(bytes: number): string { if (bytes === 0) return '0 Bytes'; const k = 1024; const sizes = ['Bytes', 'KB', 'MB', 'GB']; const i = Math.floor(Math.log(bytes) / Math.log(k)); return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i]; }

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/quinny1187/obsidian-mcp'

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