update-note
Modify existing notes on the MCP Notes Server by updating their name and content. Use this tool to ensure your notes stay current and accurate.
Instructions
Update an existing note
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| content | Yes | ||
| name | Yes |
Input Schema (JSON Schema)
{
"properties": {
"content": {
"type": "string"
},
"name": {
"type": "string"
}
},
"required": [
"name",
"content"
],
"type": "object"
}
Implementation Reference
- src/notes/tools/handle_tools.py:44-61 (handler)The _handle_update_note method that executes the tool logic for updating a note, including validation and response formatting.async def _handle_update_note(self, arguments: Optional[Dict]) -> List[types.TextContent]: """Process note update requests.""" if not arguments: raise ValueError("Missing arguments") note_name = arguments.get("name") content = arguments.get("content") if not note_name or not content: raise ValueError("Missing name or content") current_time, content = self.storage.update_note(note_name, content) return [ types.TextContent( type="text", text=f"Updated note '{note_name}' with content: {content}\nModified at: {current_time}", ) ]
- src/notes/tools/list_tools.py:31-42 (schema)Defines the input schema, name, and description for the update-note tool.types.Tool( name="update-note", description="Update an existing note", inputSchema={ "type": "object", "properties": { "name": {"type": "string"}, "content": {"type": "string"}, }, "required": ["name", "content"], }, ),
- src/notes/server.py:41-44 (registration)MCP server registration for listing tools, which includes the update-note tool schema.@server.list_tools() async def handle_list_tools() -> list[types.Tool]: """Return list of available note management tools.""" return tool_list.get_tool_list()
- src/notes/server.py:46-51 (registration)MCP server registration for calling tools, which routes update-note calls to the handler.@server.call_tool() async def handle_call_tool(name: str, arguments: dict | None) -> list[types.TextContent]: """Execute requested note management tool.""" result = await tool_handler.handle_tool(name, arguments) await server.request_context.session.send_resource_list_changed() return result
- src/notes/storage.py:45-54 (helper)Supporting method in NoteStorage that updates the note content and timestamps, used by the tool handler.def update_note(self, name: str, content: str) -> tuple[str, str]: """Update existing note's content and modified time.""" if name not in self.notes: raise ValueError(f"Note '{name}' not found") current_time = datetime.now().isoformat() self.notes[name]["content"] = content self.notes[name]["modified_at"] = current_time self.save_notes() return current_time, content