Skip to main content
Glama

update_metadata

Modifies YAML frontmatter in Markdown documents to update document metadata such as status, tags, author, and date.

Instructions

Modifies the document's Frontmatter.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathYes
metadataYes

Implementation Reference

  • Main tool handler in EditTool class: loads Document, updates metadata via Document.update_metadata(), saves file if successful.
    async def update_metadata(self, file_path: str, metadata: Dict[str, Any]) -> Dict[str, Any]: doc = self.get_doc(file_path) result = doc.update_metadata(metadata) if "success" in result: with open(file_path, 'w', encoding='utf-8') as f: f.write(doc.get_content()) return result
  • Registers the update_metadata tool in MCP server with full inputSchema (file_path: str, metadata: object) and outputSchema (success: bool). Includes title and description.
    Tool( name="update_metadata", title="Update YAML Metadata", description="Modifies the document's Frontmatter.", inputSchema={ "type": "object", "properties": { "file_path": { "type": "string", "examples": ["./document.md", "./blog/post.md"] }, "metadata": { "type": "object", "examples": [ {"status": "published", "tags": ["mcp", "ai"]}, {"author": "John Doe", "date": "2025-12-27"} ] } }, "required": ["file_path", "metadata"], "additionalProperties": False }, outputSchema={ "type": "object", "properties": { "success": {"type": "boolean"} } } ),
  • Input/output schemas defined for the tool: inputs file_path (string) and metadata (object), outputs success boolean. Examples provided.
    Tool( name="update_metadata", title="Update YAML Metadata", description="Modifies the document's Frontmatter.", inputSchema={ "type": "object", "properties": { "file_path": { "type": "string", "examples": ["./document.md", "./blog/post.md"] }, "metadata": { "type": "object", "examples": [ {"status": "published", "tags": ["mcp", "ai"]}, {"author": "John Doe", "date": "2025-12-27"} ] } }, "required": ["file_path", "metadata"], "additionalProperties": False }, outputSchema={ "type": "object", "properties": { "success": {"type": "boolean"} } } ),
  • Document class helper: updates internal metadata dict with new_metadata, rebuilds raw_content via serializer, returns old/new for confirmation.
    def update_metadata(self, new_metadata: Dict[str, Any]) -> Dict[str, Any]: """Update YAML metadata""" old = deepcopy(self.metadata) self.metadata.update(new_metadata) self._rebuild_raw_content() return {"success": True, "old": old, "new": self.metadata}

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/KazKozDev/markdown-editor-mcp-server'

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