Skip to main content
Glama
abutbul

Gatherings MCP Server

by abutbul

record_payment

Record member payments for social events to track expenses and calculate reimbursements, helping friends settle balances.

Instructions

Record a payment made by a member

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
gathering_idYesID of the gathering
member_nameYesName of the member making the payment
amountYesAmount paid (negative for reimbursements)

Implementation Reference

  • src/index.ts:118-139 (registration)
    MCP tool registration for 'record_payment' including name, description, and input schema.
    {
      name: 'record_payment',
      description: 'Record a payment made by a member',
      inputSchema: {
        type: 'object',
        properties: {
          gathering_id: {
            type: 'string',
            description: 'ID of the gathering',
          },
          member_name: {
            type: 'string',
            description: 'Name of the member making the payment',
          },
          amount: {
            type: 'number',
            description: 'Amount paid (negative for reimbursements)',
          },
        },
        required: ['gathering_id', 'member_name', 'amount'],
      },
    },
  • Input schema definition for the 'record_payment' MCP tool.
    inputSchema: {
      type: 'object',
      properties: {
        gathering_id: {
          type: 'string',
          description: 'ID of the gathering',
        },
        member_name: {
          type: 'string',
          description: 'Name of the member making the payment',
        },
        amount: {
          type: 'number',
          description: 'Amount paid (negative for reimbursements)',
        },
      },
      required: ['gathering_id', 'member_name', 'amount'],
    },
  • MCP CallTool handler for 'record_payment': validates input using isExpenseArgs and constructs the CLI command to invoke the Python script.
    case 'record_payment':
      if (!isExpenseArgs(args)) {
        throw new McpError(ErrorCode.InvalidParams, 'Invalid record_payment arguments');
      }
      command += ` record-payment "${args.gathering_id}" "${args.member_name}" ${args.amount}`;
      break;
  • CLI command handler for 'record-payment': invokes service.record_payment and formats JSON or text output.
    def handle_record_payment(service, args):
        """Handle the record-payment command."""
        try:
            gathering, member = service.record_payment(args.gathering_id, args.member_name, args.amount)
            result = {
                "success": True,
                "payment": {
                    "member": member.name,
                    "amount": args.amount,
                    "type": "reimbursement" if args.amount < 0 else "payment"
                }
            }
            if args.json:
                print(json.dumps(result))
            else:
                if args.amount < 0:
                    print(f"Recorded reimbursement of ${abs(args.amount):.2f} to {member.name}")
                else:
                    print(f"Recorded payment of ${args.amount:.2f} from {member.name}")
            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
  • Core database handler: validates gathering and member, creates a new Payment record in the database, commits, and returns updated objects.
    def record_payment(self, gathering_id: str, member_name: str, amount: float) -> Tuple[Gathering, Member]:
        """
        Record a payment made by a member.
        
        Args:
            gathering_id: The ID of the gathering
            member_name: The name of the member
            amount: The payment amount (positive for payments, negative for reimbursements)
            
        Returns:
            Tuple of (updated Gathering, Member who paid/received)
            
        Raises:
            ValueError: If the gathering is closed, the member doesn't exist, or the payment is invalid
        """
        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 record payment to closed gathering '{gathering_id}'")
            
            # Get the member
            member = session.query(Member).filter_by(gathering_id=gathering_id, name=member_name).first()
            if not member:
                raise ValueError(f"Member '{member_name}' not found in gathering '{gathering_id}'")
            
            # Add the payment
            payment = Payment(member_id=member.id, amount=amount)
            session.add(payment)
            
            session.commit()
            
            # Get fresh copies of the gathering and member
            updated_gathering = self.get_gathering(gathering_id)
            
            # Find the member in the updated gathering
            updated_member = None
            for m in updated_gathering.members:
                if m.name == member_name:
                    updated_member = m
                    break
                    
            if not updated_member:
                raise ValueError(f"Cannot find member '{member_name}' after recording payment")
                
            return updated_gathering, updated_member
            
        except Exception as e:
            session.rollback()
            raise e
        finally:
            session.close()
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool records a payment, implying a write operation, but fails to detail critical aspects like whether this is idempotent, requires specific permissions, affects gathering status, or has side effects (e.g., updating balances). For a mutation tool with zero annotation coverage, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It is front-loaded and wastes no space, making it easy to parse quickly. This exemplifies optimal conciseness for a simple tool description.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity as a mutation operation with no annotations and no output schema, the description is incomplete. It does not explain what happens after recording (e.g., confirmation, error handling, or impact on other tools like 'calculate_reimbursements'). For a tool that modifies data, more context is needed to ensure safe and correct usage by an AI agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with clear parameter definitions (e.g., 'amount' includes note on negative values for reimbursements). The description adds no additional parameter semantics beyond what the schema provides, such as examples or constraints. Given the high schema coverage, the baseline score of 3 is appropriate, as the schema adequately documents parameters without extra help from the description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Record a payment') and the resource ('made by a member'), making the purpose specific and understandable. However, it does not differentiate this tool from potential siblings like 'add_expense' or 'calculate_reimbursements', which might involve similar financial operations, leaving room for ambiguity in tool selection.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It does not mention prerequisites, such as whether a gathering must exist or be open, or specify scenarios like recording payments versus expenses. This lack of context could lead to incorrect tool invocation in a workflow with multiple financial tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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