Skip to main content
Glama
MarkusPfundstein

MCP server for Obsidian

obsidian_get_recent_periodic_notes

Retrieve recent periodic notes (daily, weekly, monthly, quarterly, yearly) from Obsidian vault to track progress and review time-based entries.

Instructions

Get most recent periodic notes for the specified period type.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
periodYesThe period type (daily, weekly, monthly, quarterly, yearly)
limitNoMaximum number of notes to return (default: 5)
include_contentNoWhether to include note content (default: false)

Implementation Reference

  • The `run_tool` method in `RecentPeriodicNotesToolHandler` class implements the tool logic: validates input parameters (period, limit, include_content), instantiates Obsidian API client, calls `api.get_recent_periodic_notes`, and returns JSON-formatted results.
    def run_tool(self, args: dict) -> Sequence[TextContent | ImageContent | EmbeddedResource]: if "period" not in args: raise RuntimeError("period argument missing in arguments") period = args["period"] valid_periods = ["daily", "weekly", "monthly", "quarterly", "yearly"] if period not in valid_periods: raise RuntimeError(f"Invalid period: {period}. Must be one of: {', '.join(valid_periods)}") limit = args.get("limit", 5) if not isinstance(limit, int) or limit < 1: raise RuntimeError(f"Invalid limit: {limit}. Must be a positive integer") include_content = args.get("include_content", False) if not isinstance(include_content, bool): raise RuntimeError(f"Invalid include_content: {include_content}. Must be a boolean") api = obsidian.Obsidian(api_key=api_key, host=obsidian_host) results = api.get_recent_periodic_notes(period, limit, include_content) return [ TextContent( type="text", text=json.dumps(results, indent=2) ) ]
  • The `get_tool_description` method defines the tool's metadata including name, description, and input schema (JSON Schema) for parameters: period (required, enum), limit (optional, 1-50), include_content (optional boolean).
    def get_tool_description(self): return Tool( name=self.name, description="Get most recent periodic notes for the specified period type.", inputSchema={ "type": "object", "properties": { "period": { "type": "string", "description": "The period type (daily, weekly, monthly, quarterly, yearly)", "enum": ["daily", "weekly", "monthly", "quarterly", "yearly"] }, "limit": { "type": "integer", "description": "Maximum number of notes to return (default: 5)", "default": 5, "minimum": 1, "maximum": 50 }, "include_content": { "type": "boolean", "description": "Whether to include note content (default: false)", "default": False } }, "required": ["period"] } )
  • The tool handlers are registered in a dictionary via `add_tool_handler(tools.RecentPeriodicNotesToolHandler())` at line 55, which uses the tool name from the handler's __init__. The `list_tools` and `call_tool` methods use this registry.
    tool_handlers = {} def add_tool_handler(tool_class: tools.ToolHandler): global tool_handlers tool_handlers[tool_class.name] = tool_class def get_tool_handler(name: str) -> tools.ToolHandler | None: if name not in tool_handlers: return None return tool_handlers[name] add_tool_handler(tools.ListFilesInDirToolHandler()) add_tool_handler(tools.ListFilesInVaultToolHandler()) add_tool_handler(tools.GetFileContentsToolHandler()) add_tool_handler(tools.SearchToolHandler()) add_tool_handler(tools.PatchContentToolHandler()) add_tool_handler(tools.AppendContentToolHandler()) add_tool_handler(tools.PutContentToolHandler()) add_tool_handler(tools.DeleteFileToolHandler()) add_tool_handler(tools.ComplexSearchToolHandler()) add_tool_handler(tools.BatchGetFileContentsToolHandler()) add_tool_handler(tools.PeriodicNotesToolHandler()) add_tool_handler(tools.RecentPeriodicNotesToolHandler()) add_tool_handler(tools.RecentChangesToolHandler())
  • The `Obsidian` class method `get_recent_periodic_notes` makes an HTTP GET request to the Obsidian API endpoint `/periodic/{period}/recent` with limit and includeContent params, handles errors, and returns JSON response. Called by the tool handler.
    def get_recent_periodic_notes(self, period: str, limit: int = 5, include_content: bool = False) -> Any: """Get most recent periodic notes for the specified period type. Args: period: The period type (daily, weekly, monthly, quarterly, yearly) limit: Maximum number of notes to return (default: 5) include_content: Whether to include note content (default: False) Returns: List of recent periodic notes """ url = f"{self.get_base_url()}/periodic/{period}/recent" params = { "limit": limit, "includeContent": include_content } def call_fn(): response = requests.get( url, headers=self._get_headers(), params=params, verify=self.verify_ssl, timeout=self.timeout ) response.raise_for_status() return response.json() return self._safe_call(call_fn)

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

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