Skip to main content
Glama
abutbul

Gatherings MCP Server

by abutbul

add_member

Add a new member to a social event managed on Gatherings MCP Server by specifying the gathering ID and member name to track expenses and reimbursements.

Instructions

Add a new member to a gathering

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
gathering_idYesID of the gathering
member_nameYesName of the member to add

Implementation Reference

  • Input schema definition for the 'add_member' MCP tool, specifying required gathering_id and member_name string parameters.
    { name: 'add_member', description: 'Add a new member to a gathering', inputSchema: { type: 'object', properties: { gathering_id: { type: 'string', description: 'ID of the gathering', }, member_name: { type: 'string', description: 'Name of the member to add', }, }, required: ['gathering_id', 'member_name'], },
  • MCP server handler for the 'add_member' tool: validates input arguments and constructs the Python CLI command to execute 'add-member'.
    case 'add_member': if (!isMemberArgs(args)) { throw new McpError(ErrorCode.InvalidParams, 'Invalid add_member arguments'); } command += ` add-member "${args.gathering_id}" "${args.member_name}"`; break;
  • CLI handler function for 'add-member' command: invokes GatheringService.add_member and returns formatted success/error output.
    def handle_add_member(service, args): """Handle the add-member command.""" try: gathering, member = service.add_member(args.gathering_id, args.member_name) result = { "success": True, "member": { "name": member.name, "gathering_id": gathering.id, "total_members": gathering.total_members } } if args.json: print(json.dumps(result)) else: print(f"Added member '{member.name}' to gathering '{gathering.id}'") print(f"Total members: {gathering.total_members}") 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.add_member: delegates to DatabaseManager.add_member and fetches updated gathering object.
    def add_member(self, gathering_id: str, member_name: str) -> Tuple[Gathering, Member]: """ Add a new member to an existing gathering. Args: gathering_id: The ID of the gathering member_name: The name of the member to add Returns: Tuple of (updated Gathering, added Member) Raises: ValueError: If the gathering is closed, doesn't exist, or member already exists """ member = self.db_manager.add_member(gathering_id, member_name) gathering = self.get_gathering(gathering_id) return gathering, member
  • DatabaseManager.add_member core implementation: validates gathering and member, creates new Member record, increments total_members, commits transaction.
    def add_member(self, gathering_id: str, member_name: str) -> Member: """ Add a member to a gathering. Args: gathering_id: The ID of the gathering member_name: The name of the member Returns: The created Member object Raises: ValueError: If the gathering doesn't exist or is closed, or the member already exists """ 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 gathering is open if gathering.status == GatheringStatus.CLOSED: raise ValueError(f"Cannot add member to closed gathering '{gathering_id}'") # Check if member already exists existing_member = session.query(Member).filter_by(gathering_id=gathering_id, name=member_name).first() if existing_member: raise ValueError(f"Member '{member_name}' already exists in gathering '{gathering_id}'") # Create the member member = Member(name=member_name, gathering_id=gathering_id) session.add(member) # Update the total members count gathering.total_members += 1 session.commit() return member 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