Skip to main content
Glama
abutbul

Gatherings MCP Server

by abutbul

delete_gathering

Remove a social event from the Gatherings MCP Server to stop tracking its expenses and reimbursements, optionally forcing deletion of closed gatherings.

Instructions

Delete a gathering

Input Schema

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

Implementation Reference

  • src/index.ts:198-216 (registration)
    Registration of the 'delete_gathering' tool in the MCP server's ListTools response, including name, 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'],
      },
    },
  • Type guard function for validating input arguments to the delete_gathering tool.
    const isDeleteGatheringArgs = (args: any): args is { gathering_id: string; force?: boolean } =>
      typeof args === 'object' && args !== null &&
      typeof args.gathering_id === 'string' &&
      (args.force === undefined || typeof args.force === 'boolean');
  • MCP tool handler for 'delete_gathering': validates args and constructs CLI command to execute python script.
    case 'delete_gathering':
      if (!isDeleteGatheringArgs(args)) {
        throw new McpError(ErrorCode.InvalidParams, 'Invalid delete_gathering arguments');
      }
      command += ` delete "${args.gathering_id}"${args.force ? ' --force' : ''}`;
      break;
  • CLI handler for 'delete' command that calls the service to delete the gathering and outputs result.
    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
  • DatabaseManager.delete_gathering: core implementation that deletes the gathering record and cascades to related data.
    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()

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