Skip to main content
Glama
bossjones

Datetime MCP Server

by bossjones

add-note

Create and store a new note with a name and content in the Datetime MCP Server's note management system.

Instructions

Add a new note

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
contentYes

Implementation Reference

  • The handler logic for the 'add-note' tool within the handle_call_tool function. It validates the input arguments, stores the note in the global 'notes' dictionary, notifies connected clients about resource changes, and returns a confirmation TextContent.
    if name == "add-note":
        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")
    
        # Update server state
        notes[note_name] = content
    
        # Notify clients that resources have changed - only if in a request context
        try:
            await server.request_context.session.send_resource_list_changed()
        except LookupError:
            # Running outside of a request context (e.g., in tests)
            pass
    
        return [
            types.TextContent(
                type="text",
                text=f"Added note '{note_name}' with content: {content}",
            )
        ]
  • The JSON schema definition for the 'add-note' tool, including required properties 'name' and 'content', registered in the handle_list_tools function.
    types.Tool(
        name="add-note",
        description="Add a new note",
        inputSchema={
            "type": "object",
            "properties": {
                "name": {"type": "string"},
                "content": {"type": "string"},
            },
            "required": ["name", "content"],
        },
    ),
  • The tool registration in the handle_list_tools function, which returns a list of available tools including 'add-note'.
    return [
        types.Tool(
            name="add-note",
            description="Add a new note",
            inputSchema={
                "type": "object",
                "properties": {
                    "name": {"type": "string"},
                    "content": {"type": "string"},
                },
                "required": ["name", "content"],
            },
        ),
        types.Tool(
            name="get-current-time",
            description="Get the current time in various formats",
            inputSchema={
                "type": "object",
                "properties": {
                    "format": {
                        "type": "string",
                        "enum": ["iso", "readable", "unix", "rfc3339"],
                        "description": "Format to return the time in"
                    },
                    "timezone": {
                        "type": "string",
                        "description": "Optional timezone (default: local system timezone)"
                    }
                },
                "required": ["format"]
            }
        ),
        types.Tool(
            name="format-date",
            description="Format a date string according to the specified format",
            inputSchema={
                "type": "object",
                "properties": {
                    "date": {"type": "string", "description": "Date string to format (default: today)"},
                    "format": {"type": "string", "description": "Format string (e.g., '%Y-%m-%d %H:%M:%S')"}
                },
                "required": ["format"]
            }
        )
    ]
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/bossjones/datetime-mcp-server'

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