Skip to main content
Glama

add-note

Add a note to the MCP News Server to store or organize information related to news articles, tech, data science, or cybersecurity. Specify a name and content for efficient tracking.

Instructions

Add a new note

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentYes
nameYes

Implementation Reference

  • Handler function that executes the 'add-note' tool: validates arguments, stores note in global state, notifies resource changes, and returns confirmation.
    @server.call_tool() async def handle_call_tool( name: str, arguments: dict | None ) -> list[types.TextContent | types.ImageContent | types.EmbeddedResource]: """ Handle tool execution requests. Tools can modify server state and notify clients of changes. """ if name != "add-note": raise ValueError(f"Unknown tool: {name}") 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 await server.request_context.session.send_resource_list_changed() return [ types.TextContent( type="text", text=f"Added note '{note_name}' with content: {content}", ) ]
  • JSON Schema defining the input for 'add-note' tool: requires 'name' and 'content' as strings.
    types.Tool( name="add-note", description="Add a new note", inputSchema={ "type": "object", "properties": { "name": {"type": "string"}, "content": {"type": "string"}, }, "required": ["name", "content"], }, ) ]
  • Registers the 'add-note' tool by returning it in the list_tools response with name, description, and schema.
    async def handle_list_tools() -> list[types.Tool]: """ List available tools. Each tool specifies its arguments using JSON Schema validation. """ return [ types.Tool( name="add-note", description="Add a new note", inputSchema={ "type": "object", "properties": { "name": {"type": "string"}, "content": {"type": "string"}, }, "required": ["name", "content"], }, ) ]
  • Global dictionary used to store notes persistently across tool calls.
    # Store notes as a simple key-value dict to demonstrate state management notes: dict[str, str] = {}

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/eluc1a/mcp-news'

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