Skip to main content
Glama
cwente25

Knowledge Base MCP Server

by cwente25

update_note

Modify existing notes in your knowledge base by updating content, tags, or categories to keep information current and organized.

Instructions

Update an existing note's content or tags

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
category_pathYesCategory path (e.g., 'work/clients/acme')
titleYesNote title
contentNoNew content (optional)
tagsNoNew comma-separated tags (optional)
appendNoIf true, append content instead of replacing (default: false)

Implementation Reference

  • The handler function for the 'update_note' MCP tool. It extracts parameters from arguments, parses tags, calls the storage layer to update the note, formats a success message with details, and handles errors by returning appropriate TextContent.
    async def handle_update_note(arguments: dict) -> list[TextContent]:
        """Handle update_note tool call."""
        try:
            category_path = arguments["category_path"]
            title = arguments["title"]
            content = arguments.get("content")
            tags_str = arguments.get("tags")
            append = arguments.get("append", False)
    
            # Parse tags
            tags = None
            if tags_str:
                tags = [tag.strip() for tag in tags_str.split(",") if tag.strip()]
    
            # Update note
            note = storage.update_note(
                category_path=category_path,
                title=title,
                content=content,
                tags=tags,
                append=append
            )
    
            result = f"✓ Note '{title}' updated successfully\n"
            result += f"  Category: {category_path or 'root'}\n"
    
            if tags:
                result += f"  Tags: {', '.join(note.frontmatter.tags)}\n"
    
            result += f"  Last updated: {note.frontmatter.updated}"
    
            return [TextContent(type="text", text=result)]
        except (NoteNotFoundError, StorageError) as e:
            return [TextContent(type="text", text=str(e))]
        except Exception as e:
            return [TextContent(type="text", text=f"❌ Error: {str(e)}")]
  • Registration of the 'update_note' tool in the MCP server's list_tools() method, including name, description, and JSON input schema defining parameters and validation.
    Tool(
        name="update_note",
        description="Update an existing note's content or tags",
        inputSchema={
            "type": "object",
            "properties": {
                "category_path": {
                    "type": "string",
                    "description": "Category path (e.g., 'work/clients/acme')",
                },
                "title": {
                    "type": "string",
                    "description": "Note title",
                },
                "content": {
                    "type": "string",
                    "description": "New content (optional)",
                },
                "tags": {
                    "type": "string",
                    "description": "New comma-separated tags (optional)",
                },
                "append": {
                    "type": "boolean",
                    "description": "If true, append content instead of replacing (default: false)",
                    "default": False,
                },
            },
            "required": ["category_path", "title"],
        },
    ),
  • Core helper method in KnowledgeBaseStorage that implements the note update logic: retrieves the note, updates content (replace or append), tags, metadata, timestamp, writes to file with backup, and returns the updated Note object.
    def update_note(
        self,
        category_path: str,
        title: str,
        content: Optional[str] = None,
        tags: Optional[list[str]] = None,
        append: bool = False,
        metadata: Optional[dict] = None
    ) -> Note:
        """
        Update an existing note.
    
        Args:
            category_path: Category path (e.g., "work/clients/acme")
            title: Note title
            content: New content (or content to append)
            tags: New tags (replaces existing)
            append: If True, append content instead of replacing
            metadata: Additional metadata to update
    
        Returns:
            Updated Note object
    
        Raises:
            NoteNotFoundError: If note doesn't exist
        """
        # Get existing note
        normalized = normalize_path(category_path)
        note = self.get_note(normalized, title)
    
        # Update content
        if content is not None:
            if append:
                note.content = note.content.strip() + "\n\n" + content
            else:
                note.content = content
    
        # Update tags
        if tags is not None:
            note.frontmatter.tags = tags
    
        # Update metadata
        if metadata is not None:
            note.frontmatter.metadata.update(metadata)
    
        # Update timestamp
        note.frontmatter.updated = datetime.now().strftime("%Y-%m-%d")
    
        # Write updated note
        file_path = Path(note.file_path)
        self._write_note_file(note, file_path, backup=True)
    
        return note
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but offers minimal behavioral insight. It indicates a mutation ('Update') but doesn't disclose permissions needed, whether changes are reversible, error handling, or rate limits. This is inadequate 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 with zero waste, front-loading the core action ('Update an existing note') and key modifiable attributes. Every word earns its place, making it highly concise and well-structured.

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 as a mutation with 5 parameters and no output schema or annotations, the description is incomplete. It lacks details on behavioral traits (e.g., side effects, error cases), usage context, and return values, which are crucial for safe and effective agent invocation.

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 schema fully documents all 5 parameters. The description adds no additional meaning beyond implying that 'content' and 'tags' are updatable fields, which is already clear from the schema. Baseline 3 is appropriate as the schema handles parameter semantics effectively.

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 ('Update') and resource ('an existing note'), specifying what fields can be modified ('content or tags'). It distinguishes from siblings like 'add_note' (create new) and 'delete_note' (remove), though it doesn't explicitly contrast with 'get_note' (read) or 'search_otes' (query).

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 on when to use this tool versus alternatives is provided. It doesn't mention prerequisites (e.g., note must exist), exclusions (e.g., cannot update non-existent notes), or comparisons to siblings like 'add_note' for creation or 'delete_note' for removal, leaving usage context implied.

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/cwente25/KnowledgeBaseMCP'

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