Skip to main content
Glama
ToKiDoO

Advanced Obsidian MCP Server

by ToKiDoO

obsidian_recent_changes

Retrieve recently modified files in your Obsidian vault to track changes and maintain organization.

Instructions

Get recently modified files in the vault.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum number of files to return (default: 10)
daysNoOnly include files modified within this many days (default: 90)

Implementation Reference

  • RecentChangesToolHandler class implements the tool 'obsidian_recent_changes'. It defines the tool schema and executes the logic by calling the Obsidian API's get_recent_changes method.
    class RecentChangesToolHandler(ToolHandler): def __init__(self): super().__init__(TOOL_RECENT_CHANGES) def get_tool_description(self): return Tool( name=self.name, description="Get recently modified files in the vault.", inputSchema={ "type": "object", "properties": { "limit": { "type": "integer", "description": "Maximum number of files to return (default: 10)", "default": 10, "minimum": 1, "maximum": 100 }, "days": { "type": "integer", "description": "Only include files modified within this many days (default: 90)", "minimum": 1, "default": 90 } } } ) def run_tool(self, args: dict) -> Sequence[TextContent | ImageContent | EmbeddedResource]: limit = args.get("limit", 10) if not isinstance(limit, int) or limit < 1: raise RuntimeError(f"Invalid limit: {limit}. Must be a positive integer") days = args.get("days", 90) if not isinstance(days, int) or days < 1: raise RuntimeError(f"Invalid days: {days}. Must be a positive integer") results = api.get_recent_changes(limit, days) return [ TextContent( type="text", text=json.dumps(results, indent=2) ) ]
  • TOOL_MAPPING dictionary registers the tool name 'obsidian_recent_changes' (TOOL_RECENT_CHANGES) with its handler class RecentChangesToolHandler. Used in register_tools() to instantiate and add to the server.
    TOOL_MAPPING = { tools.TOOL_LIST_FILES_IN_DIR: tools.ListFilesInDirToolHandler, tools.TOOL_SIMPLE_SEARCH: tools.SearchToolHandler, tools.TOOL_PATCH_CONTENT: tools.PatchContentToolHandler, tools.TOOL_PUT_CONTENT: tools.PutContentToolHandler, tools.TOOL_APPEND_CONTENT: tools.AppendContentToolHandler, tools.TOOL_DELETE_FILE: tools.DeleteFileToolHandler, tools.TOOL_COMPLEX_SEARCH: tools.ComplexSearchToolHandler, tools.TOOL_BATCH_GET_FILES: tools.BatchGetFilesToolHandler, tools.TOOL_PERIODIC_NOTES: tools.PeriodicNotesToolHandler, tools.TOOL_RECENT_PERIODIC_NOTES: tools.RecentPeriodicNotesToolHandler, tools.TOOL_RECENT_CHANGES: tools.RecentChangesToolHandler, tools.TOOL_UNDERSTAND_VAULT: tools.UnderstandVaultToolHandler, tools.TOOL_GET_ACTIVE_NOTE: tools.GetActiveNoteToolHandler, tools.TOOL_OPEN_FILES: tools.OpenFilesToolHandler, tools.TOOL_LIST_COMMANDS: tools.ListCommandsToolHandler, tools.TOOL_EXECUTE_COMMANDS: tools.ExecuteCommandsToolHandler, }
  • Obsidian API method get_recent_changes that performs the core query using Dataview DQL to fetch recently modified files from the Obsidian vault.
    def get_recent_changes(self, limit: int = 10, days: int = 90) -> Any: """Get recently modified files in the vault. Args: limit: Maximum number of files to return (default: 10) days: Only include files modified within this many days (default: 90) Returns: List of recently modified files with metadata """ # Build the DQL query query_lines = [ "TABLE file.mtime", f"WHERE file.mtime >= date(today) - dur({days} days)", "SORT file.mtime DESC", f"LIMIT {limit}" ] # Join with proper DQL line breaks dql_query = "\n".join(query_lines) # Make the request to search endpoint url = f"{self.get_base_url()}/search/" headers = self._get_headers() | { 'Content-Type': 'application/vnd.olrapi.dataview.dql+txt' } def call_fn(): response = requests.post( url, headers=headers, data=dql_query.encode('utf-8'), verify=self.verify_ssl, timeout=self.timeout ) response.raise_for_status() return response.json() return self._safe_call(call_fn)
  • Tool schema definition in get_tool_description method, specifying input parameters limit and days.
    return Tool( name=self.name, description="Get recently modified files in the vault.", inputSchema={ "type": "object", "properties": { "limit": { "type": "integer", "description": "Maximum number of files to return (default: 10)", "default": 10, "minimum": 1, "maximum": 100 }, "days": { "type": "integer", "description": "Only include files modified within this many days (default: 90)", "minimum": 1, "default": 90 } } } )

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

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