Skip to main content
Glama
abutbul

Gatherings MCP Server

by abutbul

close_gathering

Terminate a gathering within Gatherings MCP Server by specifying its ID, enabling users to efficiently finalize and manage event-related expenses and reimbursements.

Instructions

Close a gathering

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
gathering_idYesID of the gathering to close

Implementation Reference

  • Input schema definition for the 'close_gathering' MCP tool, specifying the required 'gathering_id' parameter.
    { name: 'close_gathering', description: 'Close a gathering', inputSchema: { type: 'object', properties: { gathering_id: { type: 'string', description: 'ID of the gathering to close', }, }, required: ['gathering_id'], }, },
  • MCP CallToolRequest handler for 'close_gathering': validates input and builds Python CLI command to execute the close operation.
    case 'close_gathering': if (!isGatheringIdArg(args)) { throw new McpError(ErrorCode.InvalidParams, 'Invalid close_gathering arguments'); } command += ` close "${args.gathering_id}"`; break;
  • CLI handler for the 'close' command invoked by the MCP server, calls the service to close the gathering and returns JSON response.
    def handle_close(service, args): """Handle the close command.""" try: gathering = service.close_gathering(args.gathering_id) result = { "success": True, "gathering": { "id": gathering.id, "status": gathering.status.value } } if args.json: print(json.dumps(result)) else: print(f"Closed gathering: {gathering.id}") print(f"Status: {gathering.status.value}") 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
  • GatheringService method that delegates the close_gathering operation to the DatabaseManager.
    def close_gathering(self, gathering_id: str) -> Gathering: """ Close a gathering. Args: gathering_id: The ID of the gathering Returns: The updated Gathering object Raises: ValueError: If the gathering doesn't exist or is already closed """ return self.db_manager.close_gathering(gathering_id)
  • DatabaseManager.close_gathering: core logic to close a gathering by updating its status to CLOSED in the database.
    def close_gathering(self, gathering_id: str) -> Gathering: """ Close a gathering. Args: gathering_id: The ID of the gathering Returns: The updated Gathering object Raises: ValueError: If the gathering doesn't exist or is already closed """ 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 already closed if gathering.status == GatheringStatus.CLOSED: raise ValueError(f"Gathering '{gathering_id}' is already closed") # Close the gathering gathering.status = GatheringStatus.CLOSED session.commit() # Return a fresh copy of the gathering return self.get_gathering(gathering_id) except Exception as e: session.rollback() raise e finally: session.close()

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