Skip to main content
Glama
cwente25

Knowledge Base MCP Server

by cwente25

rename_category

Update category names in your knowledge base while preserving their hierarchical structure and location. Specify the current path and new name to reorganize content.

Instructions

Rename a category while keeping it in the same parent location

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
old_pathYesCurrent category path (e.g., 'work/clients')
new_nameYesNew name for the category (just the name, not full path)

Implementation Reference

  • Registration of the 'rename_category' tool with the MCP server, including its description and input schema.
    Tool(
        name="rename_category",
        description="Rename a category while keeping it in the same parent location",
        inputSchema={
            "type": "object",
            "properties": {
                "old_path": {
                    "type": "string",
                    "description": "Current category path (e.g., 'work/clients')",
                },
                "new_name": {
                    "type": "string",
                    "description": "New name for the category (just the name, not full path)",
                },
            },
            "required": ["old_path", "new_name"],
        },
    ),
  • Input schema definition for the rename_category tool, specifying parameters old_path and new_name.
    inputSchema={
        "type": "object",
        "properties": {
            "old_path": {
                "type": "string",
                "description": "Current category path (e.g., 'work/clients')",
            },
            "new_name": {
                "type": "string",
                "description": "New name for the category (just the name, not full path)",
            },
        },
        "required": ["old_path", "new_name"],
  • MCP tool handler that processes arguments for rename_category and calls the storage layer method.
    async def handle_rename_category(arguments: dict) -> list[TextContent]:
        """Handle rename_category tool call."""
        try:
            old_path = arguments["old_path"]
            new_name = arguments["new_name"]
    
            result = storage.rename_category(
                old_path=old_path,
                new_name=new_name
            )
    
            return [TextContent(type="text", text=result)]
        except (CategoryNotFoundError, CategoryExistsError, InvalidPathError, StorageError) as e:
            return [TextContent(type="text", text=str(e))]
        except Exception as e:
            return [TextContent(type="text", text=f"❌ Error: {str(e)}")]
  • Core helper method in storage layer that validates inputs, checks existence, and performs the filesystem rename operation for categories.
    def rename_category(
        self,
        old_path: str,
        new_name: str
    ) -> str:
        """
        Rename a category (keeps it in same parent location).
    
        Args:
            old_path: Current category path (e.g., "work/clients")
            new_name: New name for the category (just the name, not full path)
    
        Returns:
            Success message with new path
    
        Raises:
            CategoryNotFoundError: If category doesn't exist
            CategoryExistsError: If new name conflicts
            InvalidPathError: If new name is invalid
        """
        old_normalized = normalize_path(old_path)
        if not old_normalized:
            raise InvalidPathError("Category path cannot be empty")
    
        if not self._category_exists(old_normalized):
            raise CategoryNotFoundError(
                f"❌ Error: Category '{old_normalized}' not found"
            )
    
        # Validate new name
        is_valid, error_msg = validate_path(new_name)
        if not is_valid:
            raise InvalidPathError(f"Invalid new name: {error_msg}")
    
        if "/" in new_name:
            raise InvalidPathError(
                "New name should be just the category name, not a full path"
            )
    
        # Determine new path
        parent = get_parent_path(old_normalized)
        new_path = join_path(parent, new_name) if parent else new_name
    
        # Check if new path already exists
        if self._category_exists(new_path):
            raise CategoryExistsError(
                f"❌ Error: Category '{new_path}' already exists"
            )
    
        # Perform rename
        old_cat_path = self._get_category_path(old_normalized)
        new_cat_path = self._get_category_path(new_path)
    
        try:
            old_cat_path.rename(new_cat_path)
        except Exception as e:
            raise StorageError(f"Failed to rename category: {e}")
    
        return f"✓ Category renamed: '{old_normalized}' → '{new_path}'"
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It mentions the tool renames a category but doesn't disclose behavioral traits like whether it requires specific permissions, if the rename is reversible, what happens to child elements, or error handling for invalid paths. This is a significant gap for a mutation tool with zero annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core action ('Rename a category') and adds a clarifying constraint ('while keeping it in the same parent location'). There is zero wasted text, making it highly concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool is a mutation operation with no annotations and no output schema, the description is incomplete. It lacks details on behavioral aspects like permissions, reversibility, effects on related data, and error scenarios. For a tool that modifies data, this leaves significant gaps in understanding how to use it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents both parameters ('old_path' and 'new_name') with clear descriptions. The description adds no additional meaning beyond what the schema provides, such as format examples or constraints, resulting in the baseline score of 3.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Rename a category') and specifies the scope ('while keeping it in the same parent location'), which distinguishes it from 'move_category' that likely changes parent location. However, it doesn't explicitly differentiate from 'update_note' or other update operations, keeping it at 4 rather than 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage by specifying 'keeping it in the same parent location,' which suggests when to use this vs. 'move_category.' However, it doesn't provide explicit guidance on when to use this tool vs. alternatives like 'create_category' or 'delete_category,' or mention prerequisites such as existing category paths.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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/cwente25/KnowledgeBaseMCP'

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