Skip to main content
Glama

rename_tag

Update tag names across multiple notes in Bear Notes by specifying old and new tag values to maintain organization consistency.

Instructions

Rename a tag across all notes

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
old_tagYesCurrent tag name (without # prefix)
new_tagYesNew tag name (without # prefix)

Implementation Reference

  • The actual implementation of the `rename_tag` function which constructs and executes the Bear x-callback-url.
    def rename_tag(old_tag: str, new_tag: str) -> dict[str, str]:
        """
        Rename a tag across all notes.
    
        Args:
            old_tag: Current tag name (without # prefix)
            new_tag: New tag name (without # prefix)
    
        Returns:
            Dictionary with operation result
        """
        params = {
            "name": old_tag,
            "new_name": new_tag
        }
    
        query_string = urllib.parse.urlencode(params)
        url = f"bear://x-callback-url/rename-tag?{query_string}"
    
        return _open_bear_url(url)
  • Registration of the `rename_tag` tool in the MCP server, defining its schema and input requirements.
        name="rename_tag",
        description="Rename a tag across all notes",
        inputSchema={
            "type": "object",
            "properties": {
                "old_tag": {
                    "type": "string",
                    "description": "Current tag name (without # prefix)",
                },
                "new_tag": {
                    "type": "string",
                    "description": "New tag name (without # prefix)",
                },
            },
            "required": ["old_tag", "new_tag"],
        },
    ),
  • Tool call handler in `server.py` that invokes the `rename_tag` implementation from `bear_url.py`.
    elif name == "rename_tag":
        if not isinstance(arguments, dict) or "old_tag" not in arguments or "new_tag" not in arguments:
            raise ValueError("Missing required arguments: old_tag and new_tag")
    
        result = rename_tag(old_tag=arguments["old_tag"], new_tag=arguments["new_tag"])
        return [TextContent(type="text", text=str(result))]

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/maxim-ist/mcp-bear'

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