create_gathering
Initiate a new gathering by providing a unique ID and member count, enabling expense tracking and reimbursement calculations for social events on the Gatherings MCP Server.
Instructions
Create a new gathering
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| gathering_id | Yes | Unique ID for the gathering (format: yyyy-mm-dd-type) | |
| members | Yes | Number of members in the gathering |
Implementation Reference
- src/index.ts:295-300 (handler)MCP tool handler for 'create_gathering': validates input using type guard and constructs CLI command to execute the Python backend via subprocess.case 'create_gathering': if (!isCreateGatheringArgs(args)) { throw new McpError(ErrorCode.InvalidParams, 'Invalid create_gathering arguments'); } command += ` create "${args.gathering_id}" --members ${args.members}`; break;
- src/index.ts:65-81 (registration)Registration of the 'create_gathering' tool in the MCP server's ListTools response, including schema definition.name: 'create_gathering', description: 'Create a new gathering', inputSchema: { type: 'object', properties: { gathering_id: { type: 'string', description: 'Unique ID for the gathering (format: yyyy-mm-dd-type)', }, members: { type: 'number', description: 'Number of members in the gathering', }, }, required: ['gathering_id', 'members'], }, },
- src/index.ts:260-263 (helper)Type guard helper to validate 'create_gathering' tool arguments before execution.const isCreateGatheringArgs = (args: any): args is { gathering_id: string; members: number } => typeof args === 'object' && args !== null && typeof args.gathering_id === 'string' && typeof args.members === 'number';
- gatherings.py:91-117 (handler)CLI handler invoked by MCP server for 'create' command: calls GatheringService.create_gathering and formats output as JSON or text.def handle_create(service, args): """Handle the create command.""" try: gathering = service.create_gathering(args.gathering_id, args.members) result = { "success": True, "gathering": { "id": gathering.id, "total_members": gathering.total_members, "status": gathering.status.value } } if args.json: print(json.dumps(result)) else: print(f"Created gathering: {gathering.id}") print(f"Total members: {gathering.total_members}") 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
- services.py:32-37 (handler)GatheringService method implementing the core create_gathering logic by delegating to DatabaseManager.def create_gathering(self, gathering_id: str, total_members: int) -> Gathering: """Creates a new gathering with the specified number of members.""" gathering = self.db_manager.create_gathering(gathering_id, total_members) return gathering