Skip to main content
Glama
ergut

MCP server for LogSeq

by ergut

delete_page

Remove pages from LogSeq to manage your knowledge graph by deleting unnecessary or outdated content.

Instructions

Delete a page from LogSeq.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
page_nameYesName of the page to delete

Implementation Reference

  • The run_tool method of DeletePageToolHandler executes the core logic of the delete_page tool by instantiating the LogSeq API client and calling its delete_page method with the provided page_name argument.
    def run_tool(self, args: dict) -> list[TextContent]:
        if "page_name" not in args:
            raise RuntimeError("page_name argument required")
    
        try:
            api = logseq.LogSeq(api_key=api_key)
            result = api.delete_page(args["page_name"])
            
            # Build detailed success message
            page_name = args["page_name"]
            success_msg = f"āœ… Successfully deleted page '{page_name}'"
            
            # Add any additional info from the API result if available
            if result and isinstance(result, dict):
                if result.get("success"):
                    success_msg += f"\nšŸ“‹ Status: {result.get('message', 'Deletion confirmed')}"
            
            success_msg += f"\nšŸ—‘ļø  Page '{page_name}' has been permanently removed from LogSeq"
            
            return [TextContent(
                type="text",
                text=success_msg
            )]
        except ValueError as e:
            # Handle validation errors (page not found) gracefully
            return [TextContent(
                type="text", 
                text=f"āŒ Error: {str(e)}"
            )]
        except Exception as e:
            logger.error(f"Failed to delete page: {str(e)}")
            return [TextContent(
                type="text",
                text=f"āŒ Failed to delete page '{args['page_name']}': {str(e)}"
            )]
  • The input schema definition for the delete_page tool, specifying that a 'page_name' string is required.
    def get_tool_description(self):
        return Tool(
            name=self.name,
            description="Delete a page from LogSeq.",
            inputSchema={
                "type": "object",
                "properties": {
                    "page_name": {
                        "type": "string",
                        "description": "Name of the page to delete"
                    }
                },
                "required": ["page_name"]
            }
        )
  • Registration of all tool handlers including DeletePageToolHandler in the MCP server setup.
    logger.info("Registering tool handlers...")
    add_tool_handler(tools.CreatePageToolHandler())
    add_tool_handler(tools.ListPagesToolHandler())
    add_tool_handler(tools.GetPageContentToolHandler())
    add_tool_handler(tools.DeletePageToolHandler())
    add_tool_handler(tools.UpdatePageToolHandler())
    add_tool_handler(tools.SearchToolHandler())
  • The LogSeq API helper method delete_page that performs the actual HTTP request to Logseq's deletePage RPC method after validating the page exists.
    def delete_page(self, page_name: str) -> Any:
        """Delete a LogSeq page by name."""
        url = self.get_base_url()
        logger.info(f"Deleting page '{page_name}'")
        
        try:
            # Pre-delete validation: verify page exists
            existing_pages = self.list_pages()
            page_names = [p.get("originalName") or p.get("name") for p in existing_pages if p.get("originalName") or p.get("name")]
            
            if page_name not in page_names:
                raise ValueError(f"Page '{page_name}' does not exist")
            
            response = requests.post(
                url,
                headers=self._get_headers(),
                json={
                    "method": "logseq.Editor.deletePage",
                    "args": [page_name]
                },
                verify=self.verify_ssl,
                timeout=self.timeout
            )
            response.raise_for_status()
            result = response.json()
            logger.info(f"Successfully deleted page '{page_name}'")
            return result
    
        except ValueError:
            # Re-raise validation errors as-is
            raise
        except Exception as e:
            logger.error(f"Error deleting page '{page_name}': {str(e)}")
            raise
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 of behavioral disclosure. 'Delete' implies a destructive mutation, but the description doesn't state whether this is reversible, what permissions are required, how it affects linked content, or what happens on success/failure. For a destructive tool with zero annotation coverage, this is a significant gap in transparency.

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 with zero wasted words. It's front-loaded with the core action and resource, making it easy to parse quickly. Every word earns its place by conveying essential information.

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?

For a destructive mutation tool with no annotations and no output schema, the description is incomplete. It doesn't address critical context like irreversibility, error handling, or system impact, which are essential for safe agent operation. The high schema coverage doesn't compensate for these behavioral gaps.

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%, with the single parameter 'page_name' documented in the schema as 'Name of the page to delete'. The description adds no additional parameter context beyond what the schema provides, so it meets the baseline of 3 where the schema does the heavy lifting.

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 ('Delete') and resource ('a page from LogSeq'), making the purpose immediately understandable. It doesn't explicitly distinguish from sibling tools like 'update_page' or 'create_page', but the verb 'Delete' inherently suggests a destructive operation different from creation or modification.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives like 'update_page' or 'create_page'. It doesn't mention prerequisites, consequences, or typical use cases, leaving the agent to infer usage from the tool name alone.

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/ergut/mcp-logseq-server'

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