obsidian_append_content
Add content to Obsidian notes by appending text to new or existing files in your vault. This tool integrates with Obsidian's Local REST API to modify note files programmatically.
Instructions
Append content to a new or existing file in the vault.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filepath | Yes | Path to the file (relative to vault root) | |
| content | Yes | Content to append to the file |
Implementation Reference
- src/mcp_obsidian/tools.py:217-229 (handler)The run_tool method implements the core logic of the obsidian_append_content tool: validates arguments, calls the Obsidian API to append content, and returns a success message.def run_tool(self, args: dict) -> Sequence[TextContent | ImageContent | EmbeddedResource]: if "filepath" not in args or "content" not in args: raise RuntimeError("filepath and content arguments required") api = obsidian.Obsidian(api_key=api_key, host=obsidian_host) api.append_content(args.get("filepath", ""), args["content"]) return [ TextContent( type="text", text=f"Successfully appended content to {args['filepath']}" ) ]
- src/mcp_obsidian/tools.py:197-215 (schema)Defines the input schema and description for the obsidian_append_content tool.return Tool( name=self.name, description="Append content to a new or existing file in the vault.", inputSchema={ "type": "object", "properties": { "filepath": { "type": "string", "description": "Path to the file (relative to vault root)", "format": "path" }, "content": { "type": "string", "description": "Content to append to the file" } }, "required": ["filepath", "content"] } )
- src/mcp_obsidian/server.py:49-49 (registration)Registers the AppendContentToolHandler instance with the MCP server.add_tool_handler(tools.AppendContentToolHandler())