Skip to main content
Glama

Move Folder

move_folder

Move folders within Mnemosyne knowledge graphs to reorganize content. Change parent folders or reposition items among siblings to maintain structured data organization.

Instructions

Move a folder to a new parent folder. Set new_parent_id to null to move to root level. Optionally update the order for positioning among siblings.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
graph_idYes
folder_idYes
new_parent_idNo
new_orderNo

Implementation Reference

  • The main handler function for the 'move_folder' tool. It authenticates the request, validates inputs, connects to the workspace, verifies the folder exists, updates the folder's parent and order using Y.js WorkspaceWriter, and returns a success result with workspace snapshot.
    async def move_folder_tool(
        graph_id: str,
        folder_id: str,
        new_parent_id: Optional[str] = None,
        new_order: Optional[float] = None,
        context: Context | None = None,
    ) -> dict:
        """Move a folder to a new parent via Y.js."""
        auth = MCPAuthContext.from_context(context)
        auth.require_auth()
    
        if not graph_id or not graph_id.strip():
            raise ValueError("graph_id is required and cannot be empty")
        if not folder_id or not folder_id.strip():
            raise ValueError("folder_id is required and cannot be empty")
    
        try:
            await hp_client.connect_workspace(graph_id.strip())
    
            # Read current folder state from Y.js
            channel = hp_client._workspace_channels.get(graph_id.strip())
            if channel is None:
                raise RuntimeError(f"Workspace not connected: {graph_id}")
    
            reader = WorkspaceReader(channel.doc)
            current = reader.get_folder(folder_id.strip())
    
            if not current:
                raise RuntimeError(f"Folder '{folder_id}' not found in graph '{graph_id}'")
    
            # Update folder with new parent/order via Y.js
            await hp_client.transact_workspace(
                graph_id.strip(),
                lambda doc: WorkspaceWriter(doc).update_folder(
                    folder_id.strip(),
                    parent_id=new_parent_id.strip() if new_parent_id else None,
                    order=new_order,
                ),
            )
    
            snapshot = hp_client.get_workspace_snapshot(graph_id.strip())
    
            result = {
                "success": True,
                "folder_id": folder_id.strip(),
                "graph_id": graph_id.strip(),
                "new_parent_id": new_parent_id.strip() if new_parent_id else None,
                "workspace": snapshot,
            }
            return result
    
        except Exception as e:
            logger.error(
                "Failed to move folder",
                extra_context={
                    "graph_id": graph_id,
                    "folder_id": folder_id,
                    "error": str(e),
                },
            )
            raise RuntimeError(f"Failed to move folder: {e}")
  • The @server.tool decorator registers the 'move_folder' tool with its name, title, and description, which also serves as the schema definition via type hints in the function signature.
    @server.tool(
        name="move_folder",
        title="Move Folder",
        description=(
            "Move a folder to a new parent folder. "
            "Set new_parent_id to null to move to root level. "
            "Optionally update the order for positioning among siblings."
        ),
    )
  • Tool schema defined in the decorator: name, title, description. Input schema inferred from function parameters: graph_id (str), folder_id (str), new_parent_id (Optional[str]), new_order (Optional[float]), context (Optional[Context]). Output: dict.
    @server.tool(
        name="move_folder",
        title="Move Folder",
        description=(
            "Move a folder to a new parent folder. "
            "Set new_parent_id to null to move to root level. "
            "Optionally update the order for positioning among siblings."
        ),
    )
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the action ('Move') and optional ordering, but fails to address critical aspects like permissions required, whether the operation is reversible, error conditions, or what happens to child items. This is inadequate for a mutation tool.

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 efficiently structured in two sentences with zero waste. The first sentence states the core purpose, and the second provides essential usage details for parameters. Every element adds value.

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 complexity of a mutation tool with no annotations, no output schema, and 0% schema description coverage, the description is incomplete. It lacks information on permissions, side effects, error handling, and return values, which are critical for safe and effective use.

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

Parameters4/5

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

Schema description coverage is 0%, so the description must compensate. It adds meaningful context for 'new_parent_id' (null for root) and 'new_order' (positioning among siblings), clarifying their purposes beyond the schema's basic titles. However, it does not explain 'graph_id' or 'folder_id' parameters.

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

Purpose5/5

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

The description clearly states the specific action ('Move a folder') and resource ('to a new parent folder'), distinguishing it from sibling tools like 'rename_folder' or 'delete_folder'. It precisely defines the tool's function with no ambiguity.

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

Usage Guidelines4/5

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

The description provides clear context for usage ('Set new_parent_id to null to move to root level') but does not explicitly mention when to use this tool versus alternatives like 'move_document' or 'move_artifact'. It offers operational guidance but lacks sibling differentiation.

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/sophia-labs/mnemosyne-mcp'

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