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
                }
            }
        }
    )
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool retrieves files but lacks details on permissions, rate limits, error handling, or the return format (e.g., list structure, metadata included). This is a significant gap for a tool with potential operational implications.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's function without unnecessary words. It is front-loaded and easy to parse, making it highly concise and well-structured for quick understanding.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (2 parameters, no output schema, no annotations), the description is minimally adequate. It covers the basic purpose but lacks details on behavioral aspects and usage context, which are needed for a complete understanding, especially without annotations to fill in gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, clearly documenting both parameters ('limit' and 'days') with defaults and constraints. The description does not add any parameter-specific information beyond what the schema provides, so it meets the baseline score of 3 for adequate but no extra value.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('Get') and resource ('recently modified files in the vault'), making it immediately understandable. However, it does not explicitly differentiate from sibling tools like 'obsidian_list_files_in_dir' or 'obsidian_simple_search', which might also list files under different criteria, so it falls short of a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It does not mention scenarios where this tool is preferred over siblings like 'obsidian_list_files_in_dir' for listing all files or 'obsidian_simple_search' for filtered searches, leaving the agent to infer usage based on the name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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