Skip to main content
Glama
MarkusPfundstein

MCP server for Obsidian

obsidian_get_periodic_note

Retrieve current periodic notes (daily, weekly, monthly, quarterly, yearly) from Obsidian vaults, returning either content or metadata as needed.

Instructions

Get current periodic note for the specified period.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
periodYesThe period type (daily, weekly, monthly, quarterly, yearly)
typeNoThe type of data to get ('content' or 'metadata'). 'content' returns just the content in Markdown format. 'metadata' includes note metadata (including paths, tags, etc.) and the content.content

Implementation Reference

  • The run_tool method of PeriodicNotesToolHandler that validates arguments and calls the Obsidian API to get the periodic note content.
    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)}") type = args["type"] if "type" in args else "content" valid_types = ["content", "metadata"] if type not in valid_types: raise RuntimeError(f"Invalid type: {type}. Must be one of: {', '.join(valid_types)}") api = obsidian.Obsidian(api_key=api_key, host=obsidian_host) content = api.get_periodic_note(period,type) return [ TextContent( type="text", text=content ) ]
  • Defines the Tool schema including inputSchema for the obsidian_get_periodic_note tool.
    def get_tool_description(self): return Tool( name=self.name, description="Get current periodic note for the specified period.", inputSchema={ "type": "object", "properties": { "period": { "type": "string", "description": "The period type (daily, weekly, monthly, quarterly, yearly)", "enum": ["daily", "weekly", "monthly", "quarterly", "yearly"] }, "type": { "type": "string", "description": "The type of data to get ('content' or 'metadata'). 'content' returns just the content in Markdown format. 'metadata' includes note metadata (including paths, tags, etc.) and the content.", "default": "content", "enum": ["content", "metadata"] } }, "required": ["period"] } )
  • Registers the PeriodicNotesToolHandler instance among other tools in the MCP server.
    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 API client method that makes the HTTP request to retrieve the periodic note from the Obsidian server.
    def get_periodic_note(self, period: str, type: str = "content") -> Any: """Get current periodic note for the specified period. Args: period: The period type (daily, weekly, monthly, quarterly, yearly) type: Type of the data to get ('content' or 'metadata'). 'content' returns just the content in Markdown format. 'metadata' includes note metadata (including paths, tags, etc.) and the content.. Returns: Content of the periodic note """ url = f"{self.get_base_url()}/periodic/{period}/" def call_fn(): headers = self._get_headers() if type == "metadata": headers['Accept'] = 'application/vnd.olrapi.note+json' response = requests.get(url, headers=headers, verify=self.verify_ssl, timeout=self.timeout) response.raise_for_status() return response.text 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