Skip to main content
Glama

create_memo

Create new memos with markdown content and visibility controls for knowledge management. Supports public, protected, or private access levels.

Instructions

Create a new memo.

Args: content: The content of the memo (supports Markdown) visibility: Visibility level - PUBLIC, PROTECTED, or PRIVATE (default: PRIVATE)

Returns: JSON string containing the created memo details

Input Schema

NameRequiredDescriptionDefault
contentYes
visibilityNoPRIVATE

Input Schema (JSON Schema)

{ "properties": { "content": { "type": "string" }, "visibility": { "default": "PRIVATE", "type": "string" } }, "required": [ "content" ], "type": "object" }

Implementation Reference

  • The main handler function for the 'create_memo' tool. It is decorated with @mcp.tool(), which registers it as an MCP tool. The function validates input, makes a POST request to the Memos API to create a new memo, and returns the result as JSON string.
    @mcp.tool() async def create_memo( content: str, visibility: str = "PRIVATE" ) -> str: """ Create a new memo. Args: content: The content of the memo (supports Markdown) visibility: Visibility level - PUBLIC, PROTECTED, or PRIVATE (default: PRIVATE) Returns: JSON string containing the created memo details """ # Validate visibility valid_visibilities = ["PUBLIC", "PROTECTED", "PRIVATE"] visibility = visibility.upper() if visibility not in valid_visibilities: return f"Error: visibility must be one of {', '.join(valid_visibilities)}" # Build request payload payload = { "content": content, "visibility": visibility } try: async with httpx.AsyncClient() as client: response = await client.post( f"{MEMOS_BASE_URL}/api/v1/memos", json=payload, headers=get_headers(), timeout=30.0 ) response.raise_for_status() memo = response.json() # Format the response result = { "success": True, "memo": { "name": memo.get("name"), "uid": memo.get("uid"), "creator": memo.get("creator"), "content": memo.get("content"), "visibility": memo.get("visibility"), "pinned": memo.get("pinned", False), "createTime": memo.get("createTime"), "updateTime": memo.get("updateTime"), "displayTime": memo.get("displayTime"), } } return str(result) except httpx.HTTPError as e: return f"Error creating memo: {str(e)}" except Exception as e: return f"Unexpected error: {str(e)}"
  • The function signature and docstring define the input schema (content: str, visibility: str = 'PRIVATE') and output (str: JSON). FastMCP likely uses this to generate the tool schema.
    async def create_memo( content: str, visibility: str = "PRIVATE" ) -> str: """ Create a new memo. Args: content: The content of the memo (supports Markdown) visibility: Visibility level - PUBLIC, PROTECTED, or PRIVATE (default: PRIVATE) Returns: JSON string containing the created memo details
  • Helper function used by create_memo to generate HTTP headers for authenticated requests to the Memos API.
    def get_headers() -> dict: """Get headers for API requests including authentication""" headers = { "Content-Type": "application/json", } if MEMOS_API_TOKEN: headers["Authorization"] = f"Bearer {MEMOS_API_TOKEN}" return headers

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/Red5d/memos_mcp'

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