Skip to main content
Glama
MarkusPfundstein

MCP server for Obsidian

obsidian_put_content

Create or update files in your Obsidian vault by specifying file paths and content. This tool helps manage your knowledge base through direct file operations.

Instructions

Create a new file in your vault or update the content of an existing one in your vault.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filepathYesPath to the relevant file (relative to your vault root)
contentYesContent of the file you would like to upload

Implementation Reference

  • The run_tool method of PutContentToolHandler implements the core logic of the 'obsidian_put_content' tool. It validates the required arguments (filepath and content), instantiates the Obsidian API client, calls api.put_content to upload the file content to the Obsidian vault, 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.put_content(args.get("filepath", ""), args["content"])
    
        return [
            TextContent(
                type="text",
                text=f"Successfully uploaded content to {args['filepath']}"
            )
        ]
  • The get_tool_description method defines the tool schema, including name, description, and inputSchema specifying required 'filepath' and 'content' parameters.
    def get_tool_description(self):
        return Tool(
            name=self.name,
            description="Create a new file in your vault or update the content of an existing one in your vault.",
            inputSchema={
                "type": "object",
                "properties": {
                    "filepath": {
                        "type": "string",
                        "description": "Path to the relevant file (relative to your vault root)",
                        "format": "path"
                    },
                    "content": {
                        "type": "string",
                        "description": "Content of the file you would like to upload"
                    }
                },
                "required": ["filepath", "content"]
            }
        )
  • The PutContentToolHandler instance is registered in the tool_handlers dictionary via add_tool_handler, making the 'obsidian_put_content' tool available to the MCP server.
    add_tool_handler(tools.PutContentToolHandler())
  • The put_content method in the Obsidian class performs the actual HTTP PUT request to the Obsidian API endpoint /vault/{filepath} to create or update the file with the provided content.
    def put_content(self, filepath: str, content: str) -> Any:
        url = f"{self.get_base_url()}/vault/{filepath}"
        
        def call_fn():
            response = requests.put(
                url, 
                headers=self._get_headers() | {'Content-Type': 'text/markdown'}, 
                data=content,
                verify=self.verify_ssl,
                timeout=self.timeout
            )
            response.raise_for_status()
            return None
    
        return self._safe_call(call_fn)
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 mentions creating or updating files but lacks details on permissions, overwrite behavior, error handling, or rate limits. This is insufficient for a mutation tool with zero annotation coverage.

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 clearly states the tool's function without unnecessary words. It is front-loaded and wastes no space, making it easy to parse quickly.

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

Completeness2/5

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

Given the tool's complexity (a mutation operation), lack of annotations, and no output schema, the description is incomplete. It fails to address critical aspects like behavioral traits, error cases, or output expectations, leaving significant gaps for an AI agent.

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?

Schema description coverage is 100%, so the input schema fully documents both parameters ('filepath' and 'content'). The description adds no additional semantic context beyond what the schema provides, meeting the baseline for high coverage.

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 verb ('create' or 'update') and resource ('file in your vault'), making the purpose understandable. It distinguishes between creating new files and updating existing ones, though it doesn't explicitly differentiate from sibling tools like 'obsidian_append_content' or 'obsidian_patch_content' beyond the basic operation.

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?

No guidance is provided on when to use this tool versus alternatives like 'obsidian_append_content' (for adding to files) or 'obsidian_patch_content' (for partial updates). The description only states what it does without context for selection among similar tools.

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

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