add-note
Create and store notes with name and content in MCPilot's unified AI toolchain environment.
Instructions
Add a new note
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| content | Yes |
Implementation Reference
- src/mcpilot/server.py:117-148 (handler)The `handle_call_tool` function executes the `add-note` tool by validating arguments, updating the global `notes` dictionary with the new note, notifying clients of resource changes, and returning 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}", ) ]
- src/mcpilot/server.py:103-115 (registration)The `add-note` tool is registered in the `handle_list_tools` function, which returns a list containing this tool definition.types.Tool( name="add-note", description="Add a new note", inputSchema={ "type": "object", "properties": { "name": {"type": "string"}, "content": {"type": "string"}, }, "required": ["name", "content"], }, ) ]
- src/mcpilot/server.py:106-113 (schema)JSON schema defining the input arguments for the `add-note` tool: required `name` and `content` strings.inputSchema={ "type": "object", "properties": { "name": {"type": "string"}, "content": {"type": "string"}, }, "required": ["name", "content"], },
- src/mcpilot/server.py:9-10 (helper)Global `notes` dictionary used to store note state, modified by the `add-note` tool.# Store notes as a simple key-value dict to demonstrate state management notes: dict[str, str] = {}