Skip to main content
Glama

delete_entities

Remove one or more entities from Kanka campaigns, including characters, locations, organizations, and quests, using entity IDs for batch deletion.

Instructions

Delete one or more entities

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
entity_idsYesArray of entity IDs to delete

Implementation Reference

  • The handle_delete_entities function is the MCP tool handler that extracts entity_ids from parameters and delegates to the operations layer for deletion. Returns list of DeleteEntityResult.
    async def handle_delete_entities(**params: Any) -> list[DeleteEntityResult]: """ Delete one or more entities. Args: **params: Parameters from DeleteEntitiesParams Returns: List of deletion results """ entity_ids = params.get("entity_ids", []) operations = get_operations() # Delegate to operations layer return await operations.delete_entities(entity_ids)
  • DeleteEntitiesParams TypedDict defines the input schema for the delete_entities tool, requiring an array of entity_ids (list[int]).
    class DeleteEntitiesParams(TypedDict): """Parameters for delete_entities tool.""" entity_ids: list[int]
  • The KankaOperations.delete_entities method implements the core deletion logic, iterating through entity_ids, calling service.delete_entity for each, and handling errors while accumulating results.
    async def delete_entities(self, entity_ids: list[int]) -> list[DeleteEntityResult]: """Delete one or more entities. Args: entity_ids: List of entity IDs to delete Returns: List of results, one per entity """ results = [] for entity_id in entity_ids: try: # Delete entity success = self.service.delete_entity(entity_id) result: DeleteEntityResult = { "entity_id": entity_id, "success": success, "error": None, } results.append(result) except Exception as e: logger.error(f"Failed to delete entity {entity_id}: {e}") error_result: DeleteEntityResult = { "entity_id": entity_id, "success": False, "error": str(e), } results.append(error_result) return results
  • Tool registration for delete_entities with name, description, and inputSchema defining the required entity_ids array parameter.
    name="delete_entities", description="Delete one or more entities", inputSchema={ "type": "object", "properties": { "entity_ids": { "type": "array", "items": {"type": "integer"}, "description": "Array of entity IDs to delete", } }, "required": ["entity_ids"], },
  • KankaService.delete_entity performs the actual Kanka API deletion - retrieves entity to determine its type, gets the appropriate API endpoint manager, and calls the delete method.
    def delete_entity(self, entity_id: int) -> bool: """ Delete an entity. Args: entity_id: Entity ID Returns: True if successful """ try: # First get the entity to find its type entity_data = self.get_entity_by_id(entity_id) if not entity_data: raise ValueError(f"Entity {entity_id} not found") entity_type = entity_data["entity_type"] manager = getattr(self.client, self.API_ENDPOINT_MAP[entity_type]) # Delete entity manager.delete(entity_data["id"]) return True except Exception as e: logger.error(f"Delete entity failed for {entity_id}: {e}") raise

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