Skip to main content
Glama
abutbul

Gatherings MCP Server

by abutbul

delete_gathering

Remove a gathering by specifying its ID. Use the force option to delete even if the gathering is closed, ensuring event data is managed effectively on the Gatherings MCP Server.

Instructions

Delete a gathering

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
forceNoForce deletion even if gathering is closed
gathering_idYesID of the gathering to delete

Implementation Reference

  • Core handler implementing the database deletion logic for the gathering, including existence check, force override for closed gatherings, and cascading deletion of related members, expenses, and payments.
    def delete_gathering(self, gathering_id: str, force: bool = False) -> None: """ Delete a gathering and all related data. Args: gathering_id: The ID of the gathering force: If True, delete even if the gathering is closed Raises: ValueError: If the gathering doesn't exist or is closed and force is False """ session = self.Session() try: # Get the gathering gathering = session.query(Gathering).filter_by(id=gathering_id).first() if not gathering: raise ValueError(f"Gathering '{gathering_id}' not found") # Check if closed and not forced if gathering.status == GatheringStatus.CLOSED and not force: raise ValueError(f"Cannot delete closed gathering '{gathering_id}'. Use --force to override.") # Delete the gathering (cascading delete will handle members, expenses, and payments) session.delete(gathering) session.commit() except Exception as e: session.rollback() raise e finally: session.close()
  • Service layer handler that delegates the deletion to the DatabaseManager.
    def delete_gathering(self, gathering_id: str, force: bool = False) -> None: """ Delete a gathering and all related data. Args: gathering_id: The ID of the gathering force: If True, delete even if the gathering is closed Raises: ValueError: If the gathering doesn't exist or is closed and force is False """ return self.db_manager.delete_gathering(gathering_id, force)
  • CLI handler for the 'delete' subcommand invoked by the MCP tool, which calls the service and handles JSON output.
    def handle_delete(service, args): """Handle the delete command.""" try: service.delete_gathering(args.gathering_id, args.force) result = { "success": True, "deleted": { "gathering_id": args.gathering_id, "forced": args.force } } if args.json: print(json.dumps(result)) else: print(f"Deleted gathering: {args.gathering_id}") return True except ValueError as e: error = {"success": False, "error": str(e)} if args.json: print(json.dumps(error)) else: print(f"Error: {e}") return False
  • MCP CallTool request handler case for 'delete_gathering', validates arguments and constructs the Python CLI command to invoke the deletion.
    case 'delete_gathering': if (!isDeleteGatheringArgs(args)) { throw new McpError(ErrorCode.InvalidParams, 'Invalid delete_gathering arguments'); } command += ` delete "${args.gathering_id}"${args.force ? ' --force' : ''}`; break;
  • src/index.ts:199-216 (registration)
    Registration of the 'delete_gathering' tool in the MCP ListTools response, including description and input schema.
    name: 'delete_gathering', description: 'Delete a gathering', inputSchema: { type: 'object', properties: { gathering_id: { type: 'string', description: 'ID of the gathering to delete', }, force: { type: 'boolean', description: 'Force deletion even if gathering is closed', default: false, }, }, required: ['gathering_id'], }, },

Other Tools

Related 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/abutbul/gatherings-mcp'

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