Skip to main content
Glama
truaxki

MCP Notes Server

by truaxki

add-note

Create and save a new note with name and content on the MCP Notes Server, enabling efficient note management and persistence through CRUD operations.

Instructions

Create a new note

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentYes
nameYes

Implementation Reference

  • The primary handler function for executing the 'add-note' tool logic, including argument validation, storage interaction, and response formatting.
    async def _handle_add_note(self, arguments: Optional[Dict]) -> List[types.TextContent]:
        """Process note creation 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.add_note(note_name, content)
        return [
            types.TextContent(
                type="text",
                text=f"Created note '{note_name}' with content: {content}\nCreated at: {current_time}",
            )
        ]
  • The schema definition for the 'add-note' tool, specifying input parameters and requirements for validation.
    types.Tool(
        name="add-note",
        description="Create a new note",
        inputSchema={
            "type": "object",
            "properties": {
                "name": {"type": "string"},
                "content": {"type": "string"},
            },
            "required": ["name", "content"],
        },
    ),
  • The tool registration entry in the list of available tools, including name, description, and schema.
    types.Tool(
        name="add-note",
        description="Create a new note",
        inputSchema={
            "type": "object",
            "properties": {
                "name": {"type": "string"},
                "content": {"type": "string"},
            },
            "required": ["name", "content"],
        },
    ),
  • Helper method in NoteStorage that performs the actual note addition to the in-memory dict and persists to JSON file.
    def add_note(self, name: str, content: str) -> tuple[str, str]:
        """Add a new note with content and timestamps."""
        if name in self.notes:
            raise ValueError(f"Note '{name}' already exists")
        
        current_time = datetime.now().isoformat()
        self.notes[name] = {
            "content": content,
            "created_at": current_time,
            "modified_at": current_time
        }
        self.save_notes()
        return current_time, content
Install Server

Other Tools

Related 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/truaxki/mcp-notes'

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