list_gatherings
Retrieve all social events tracked for expense management and reimbursement calculations between friends.
Instructions
List all gatherings
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:176-183 (registration)Registration of the 'list_gatherings' tool including name, description, and empty input schema in the MCP server's ListTools response.{ name: 'list_gatherings', description: 'List all gatherings', inputSchema: { type: 'object', properties: {}, }, },
- src/index.ts:338-340 (handler)MCP tool handler case that constructs the CLI command to execute the Python script with 'list' subcommand.command += ' list'; break;
- gatherings.py:284-315 (handler)CLI handler for the 'list' command invoked by the MCP server, which fetches gatherings and outputs the list in JSON or human-readable format.def handle_list(service, args): """Handle the list command.""" try: gatherings = service.list_gatherings() result = { "success": True, "gatherings": [ { "id": g.id, "status": g.status.value } for g in gatherings ] if gatherings else [] } if args.json: print(json.dumps(result)) else: if not gatherings: print("No gatherings found") else: print(f"Found {len(gatherings)} gatherings:") for gathering in gatherings: print(f" {gathering.id} - 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:160-167 (helper)GatheringService method that delegates listing of gatherings to the DatabaseManager.def list_gatherings(self) -> List[Gathering]: """ List all gatherings. Returns: A list of all Gathering objects """ return self.db_manager.list_gatherings()
- models.py:617-630 (helper)DatabaseManager method that queries the database for all Gathering records, implementing the core data retrieval logic.def list_gatherings(self) -> List[Gathering]: """ List all gatherings. Returns: A list of all Gathering objects """ session = self.Session() try: # Get all gatherings gatherings = session.query(Gathering).all() return gatherings finally: session.close()