Skip to main content
Glama

delete_posts

Remove posts from Kanka campaign entities to manage content and maintain organization. Specify entity and post IDs to delete unwanted entries.

Instructions

Delete posts from entities

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
deletionsYes

Implementation Reference

  • handle_delete_posts: The MCP tool handler that receives parameters and delegates to the operations layer
    async def handle_delete_posts(**params: Any) -> list[DeletePostResult]:
        """
        Delete posts from entities.
    
        Args:
            **params: Parameters from DeletePostsParams
    
        Returns:
            List of deletion results
        """
        deletions = params.get("deletions", [])
        operations = get_operations()
    
        # Delegate to operations layer
        return await operations.delete_posts(deletions)
  • delete_posts: The actual implementation that iterates through deletion requests and calls the service's delete_post method for each
    async def delete_posts(
        self, deletions: list[dict[str, Any]]
    ) -> list[DeletePostResult]:
        """Delete posts from entities.
    
        Args:
            deletions: List of post deletions to perform
    
        Returns:
            List of results, one per post
        """
        results = []
        for deletion in deletions:
            try:
                # Delete post
                success = self.service.delete_post(
                    entity_id=deletion["entity_id"],
                    post_id=deletion["post_id"],
                )
    
                result: DeletePostResult = {
                    "entity_id": deletion["entity_id"],
                    "post_id": deletion["post_id"],
                    "success": success,
                    "error": None,
                }
                results.append(result)
    
            except Exception as e:
                logger.error(
                    f"Failed to delete post {deletion['post_id']} from entity {deletion['entity_id']}: {e}"
                )
                error_result: DeletePostResult = {
                    "entity_id": deletion["entity_id"],
                    "post_id": deletion["post_id"],
                    "success": False,
                    "error": str(e),
                }
                results.append(error_result)
    
        return results
  • PostDeletion and DeletePostsParams: TypedDict schemas defining the input parameters for delete_posts tool
    class PostDeletion(TypedDict):
        """Deletion for a post."""
    
        entity_id: int
        post_id: int
    
    
    class DeletePostsParams(TypedDict):
        """Parameters for delete_posts tool."""
    
        deletions: list[PostDeletion]
  • DeletePostResult: TypedDict schema defining the output structure for delete_posts operations
    class DeletePostResult(TypedDict):
        """Result of deleting a post."""
    
        entity_id: int
        post_id: int
        success: bool
        error: str | None
  • Tool registration: Defines the delete_posts MCP tool with name, description, and input schema for validation
    types.Tool(
        name="delete_posts",
        description="Delete posts from entities",
        inputSchema={
            "type": "object",
            "properties": {
                "deletions": {
                    "type": "array",
                    "items": {
                        "type": "object",
                        "properties": {
                            "entity_id": {
                                "type": "integer",
                                "description": "The entity ID",
                            },
                            "post_id": {
                                "type": "integer",
                                "description": "The post ID to delete",
                            },
                        },
                        "required": ["entity_id", "post_id"],
                    },
                }
            },
            "required": ["deletions"],
        },
    ),

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/ervwalter/mcp-kanka'

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