Skip to main content
Glama

update_memo

Modify existing memos by updating content, visibility, or pin status to maintain current information in your knowledge base.

Instructions

Update an existing memo.

Args: memo_uid: The UID of the memo to update (e.g., "abc123") content: New content for the memo (optional) visibility: New visibility level - PUBLIC, PROTECTED, or PRIVATE (optional) pinned: Whether to pin the memo (optional)

Returns: JSON string containing the updated memo details

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
memo_uidYes
contentNo
visibilityNo
pinnedNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function for the 'update_memo' tool. It is registered via the @mcp.tool() decorator and implements the logic to update a memo's content, visibility, or pinned status by making a PATCH request to the Memos API. Includes input validation and error handling.
    @mcp.tool()
    async def update_memo(
        memo_uid: str,
        content: Optional[str] = None,
        visibility: Optional[str] = None,
        pinned: Optional[bool] = None
    ) -> str:
        """
        Update an existing memo.
        
        Args:
            memo_uid: The UID of the memo to update (e.g., "abc123")
            content: New content for the memo (optional)
            visibility: New visibility level - PUBLIC, PROTECTED, or PRIVATE (optional)
            pinned: Whether to pin the memo (optional)
        
        Returns:
            JSON string containing the updated memo details
        """
        # Validate visibility if provided
        if visibility is not None:
            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 update payload and update mask
        memo_data = {"state": "STATE_UNSPECIFIED"}
        update_paths = []
        
        if content is not None:
            memo_data["content"] = content
            update_paths.append("content")
        
        if visibility is not None:
            memo_data["visibility"] = visibility
            update_paths.append("visibility")
        
        if pinned is not None:
            memo_data["pinned"] = pinned
            update_paths.append("pinned")
        
        if not update_paths:
            return "Error: At least one field (content, visibility, or pinned) must be provided for update"
        
        # Build the full payload
        memo_name = f"memos/{memo_uid}"
        payload = {
            **memo_data
        }
    
        try:
            async with httpx.AsyncClient() as client:
                response = await client.patch(
                    f"{MEMOS_BASE_URL}/api/v1/{memo_name}",
                    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 updating memo: {str(e)}"
        except Exception as e:
            return f"Unexpected error: {str(e)}"

Tool Definition Quality

Score is being calculated. Check back soon.

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

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