Skip to main content
Glama

delete_task

Remove a task from LunaTask by specifying its unique identifier to manage your task list effectively.

Instructions

Delete an existing task in LunaTask.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The `delete_task_tool` function is the core handler that implements the logic for deleting a task in LunaTask, including error handling for various API responses.
    async def delete_task_tool(  # noqa: PLR0911
        lunatask_client: LunaTaskClient,
        ctx: Context,
        id: str,  # noqa: A002
    ) -> dict[str, Any]:
        """Delete an existing task in LunaTask.
    
        This MCP tool deletes an existing task using the LunaTask API. The task ID
        is required and will be permanently deleted.
    
        Args:
            ctx: MCP context for logging and communication
            id: Task ID to delete (required)
    
        Returns:
            dict[str, Any]: Response containing task deletion result with confirmation
    
        Raises:
            LunaTaskNotFoundError: When task is not found (404)
            LunaTaskAuthenticationError: When authentication fails (401)
            LunaTaskRateLimitError: When rate limit exceeded (429)
            LunaTaskServerError: When server error occurs (5xx)
            LunaTaskTimeoutError: When request times out
            LunaTaskAPIError: For other API errors
        """
        # Validate required task ID parameter
        if not id or not id.strip():
            error_msg = "Task ID cannot be empty"
            result = {
                "success": False,
                "error": "validation_error",
                "message": error_msg,
            }
            await ctx.error(error_msg)
            logger.warning("Empty task_id provided for deletion")
            return result
    
        await ctx.info(f"Deleting task {id}")
    
        try:
            # Use LunaTask client to delete the task. Any successful call (no exception)
            # indicates the task was deleted.
            async with lunatask_client as client:
                await client.delete_task(id)
    
            # Return success response with task ID for confirmation
            result = {
                "success": True,
                "task_id": id,
                "message": "Task deleted successfully",
            }
    
        except LunaTaskNotFoundError as e:
            # Handle task not found errors (404)
            error_msg = f"Task not found: {e}"
            result = {
                "success": False,
                "error": "not_found_error",
                "message": error_msg,
            }
            await ctx.error(error_msg)
            logger.warning("Task not found during deletion: %s", id)
            return result
    
        except LunaTaskAuthenticationError as e:
            # Handle authentication errors (401)
            error_msg = f"Authentication failed: {e}"
            result = {
                "success": False,
                "error": "authentication_error",
                "message": error_msg,
            }
            await ctx.error(error_msg)
            logger.warning("Authentication error during task deletion: %s", e)
            return result
    
        except LunaTaskRateLimitError as e:
            # Handle rate limit errors (429)
            error_msg = f"Rate limit exceeded: {e}"
            result = {
                "success": False,
                "error": "rate_limit_error",
                "message": error_msg,
            }
            await ctx.error(error_msg)
            logger.warning("Rate limit exceeded during task deletion: %s", e)
            return result
    
        except LunaTaskTimeoutError as e:
            # Handle timeout errors
            error_msg = f"Request timeout: {e}"
            result = {
                "success": False,
                "error": "timeout_error",
                "message": error_msg,
            }
            await ctx.error(error_msg)
            logger.warning("Timeout error during task deletion: %s", e)
            return result
    
        except LunaTaskServerError as e:
            # Handle server errors (5xx)
            error_msg = f"Server error: {e}"
            result = {
                "success": False,
                "error": "server_error",
                "message": error_msg,
            }
            await ctx.error(error_msg)
            logger.warning("Server error during task deletion: %s", e)
            return result
    
        except LunaTaskAPIError as e:
            # Handle other API errors
            error_msg = f"API error: {e}"
            result = {
                "success": False,
                "error": "api_error",
                "message": error_msg,
            }
            await ctx.error(error_msg)
            logger.warning("API error during task deletion: %s", e)
            return result
    
        except Exception as e:
            # Handle unexpected errors
            error_msg = f"Unexpected error deleting task: {e}"
            result = {
                "success": False,
                "error": "unexpected_error",
                "message": error_msg,
            }
            await ctx.error(error_msg)
            logger.exception("Unexpected error during task deletion")
            return result
        else:
            await ctx.info(f"Successfully deleted task {id}")
            return result
  • The `delete_task` tool is registered with the FastMCP instance in the `_register_resources` method of the `TaskTools` class.
    self.mcp.tool("delete_task")(_delete_task_tool)
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. While 'Delete' implies a destructive operation, it lacks details on permissions, reversibility, side effects, or error handling. This is inadequate 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 with zero waste. It's front-loaded with the core action and resource, making it easy to parse quickly.

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

Completeness3/5

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

Given the tool's destructive nature, no annotations, and an output schema (which may cover return values), the description is minimally adequate. It states what the tool does but lacks critical behavioral details like safety warnings or usage context, making it incomplete for informed tool selection.

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?

The description doesn't mention the 'id' parameter, and schema description coverage is 0%, so no parameter details are documented in either the schema or description. However, with only one parameter, the baseline is higher; the description implies deletion requires an existing task, which adds minimal context but doesn't fully compensate for the coverage gap.

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 the resource ('an existing task in LunaTask'), making the purpose immediately understandable. However, it doesn't differentiate this tool from sibling deletion tools like 'delete_note' or 'delete_person', which would require specifying what makes task deletion unique.

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. It doesn't mention prerequisites (e.g., needing an existing task ID), exclusions, or comparisons to sibling tools like 'update_task' or 'create_task', leaving the agent to infer usage context.

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/tensorfreitas/lunatask-mcp'

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