Skip to main content
Glama
eluc1a

MCP News Server

by eluc1a

add-note

Create and store notes with name and content for organizing information from news articles across tech, data science, cybersecurity, and other categories.

Instructions

Add a new note

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
contentYes

Implementation Reference

  • Handler function for calling the 'add-note' tool. It extracts name and content from arguments, stores the note in the global 'notes' dict, notifies clients of resource changes, and returns a confirmation message.
    @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 arguments for the 'add-note' tool: requires 'name' and 'content' as strings.
    inputSchema={
        "type": "object",
        "properties": {
            "name": {"type": "string"},
            "content": {"type": "string"},
        },
        "required": ["name", "content"],
    },
  • Registration of the 'add-note' tool in the list_tools handler, including its name, description, and input schema.
    types.Tool(
        name="add-note",
        description="Add a new note",
        inputSchema={
            "type": "object",
            "properties": {
                "name": {"type": "string"},
                "content": {"type": "string"},
            },
            "required": ["name", "content"],
        },
    )
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/eluc1a/mcp-news'

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