Skip to main content
Glama

delete_person

Remove a contact from LunaTask by specifying their person_id. This action permanently deletes the contact record and returns confirmation with deletion timestamp.

Instructions

Delete a person/contact in LunaTask by person_id. Requires person_id. Returns success status with person_id and deleted_at timestamp. Note: deletion is not idempotent - second delete will return not found error.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
person_idYes

Implementation Reference

  • The tool handler that performs the delete_person operation by interacting with the Lunatask client.
    async def delete_person_tool(
        self,
        ctx: ServerContext,
        person_id: str,
    ) -> dict[str, Any]:
        """Delete a person in LunaTask.
    
        Args:
            ctx: Server context for logging and communication
            person_id: ID of the person to delete
    
        Returns:
            Dictionary with success status, person_id, deleted_at timestamp, and message.
        """
    
        # Strip whitespace once at the beginning
        person_id = person_id.strip()
    
        await ctx.info(f"Deleting person {person_id}")
    
        # Validate person ID before making API call
        if not person_id:
            message = "Person ID cannot be empty"
            await ctx.error(message)
            logger.warning("Empty person ID provided for person deletion")
            return {
                "success": False,
                "error": "validation_error",
                "message": message,
            }
    
        try:
            async with self.lunatask_client as client:
                person_response = await client.delete_person(person_id)
    
        except Exception as error:
            return await self._handle_lunatask_api_errors(ctx, error, "person deletion")
    
        await ctx.info(f"Successfully deleted person {person_response.id}")
        logger.info("Successfully deleted person %s", person_response.id)
        return {
            "success": True,
            "person_id": person_response.id,
            "deleted_at": person_response.deleted_at.isoformat()
            if person_response.deleted_at
            else None,
            "message": "Person deleted successfully",
        }
  • The registration of the 'delete_person' tool with the MCP server.
    async def _delete_person(
        ctx: ServerContext,
        person_id: str,
    ) -> dict[str, Any]:
        return await self.delete_person_tool(ctx, person_id)
    
    self.mcp.tool(
        name="delete_person",
        description=(
            "Delete a person/contact in LunaTask by person_id. Requires person_id. "
            "Returns success status with person_id and deleted_at timestamp. "
            "Note: deletion is not idempotent - second delete will return not found error."
        ),
    )(_delete_person)

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