Skip to main content
Glama
SaharshPatel24

splitwise-mcp

get_friend_balances

Retrieve net balance summaries showing who owes you and who you owe across all friends, providing a clear overview of your financial position.

Instructions

Get a pre-computed net balance summary — who owes you, who you owe, and your overall net position across all friends. Much faster than manually summing raw balances.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for 'get_friend_balances' which fetches friend data and calculates the net balance.
    handler: async () => {
      const friends = await client.getFriends();
    
      const owesYou: Array<{ name: string; amount: number; currency: string }> = [];
      const youOwe: Array<{ name: string; amount: number; currency: string }> = [];
      let net = 0;
    
      for (const f of friends) {
        const name = `${f.first_name} ${f.last_name}`.trim();
        for (const b of f.balance) {
          const amount = parseFloat(b.amount);
          if (isNaN(amount) || amount === 0) continue;
          if (amount > 0) {
            owesYou.push({ name, amount, currency: b.currency_code });
            net += amount;
          } else {
            youOwe.push({ name, amount: Math.abs(amount), currency: b.currency_code });
            net += amount;
          }
        }
      }
    
      return {
        owes_you: owesYou,
        you_owe: youOwe,
        net: Math.round(net * 100) / 100,
        summary:
          net > 0
            ? `Overall you are owed $${net.toFixed(2)}`
            : net < 0
              ? `Overall you owe $${Math.abs(net).toFixed(2)}`
              : 'All settled up!',
      };
    },
  • The definition and registration of the 'get_friend_balances' tool.
    {
      name: 'get_friend_balances',
      description:
        'Get a pre-computed net balance summary — who owes you, who you owe, and your overall net position across all friends. Much faster than manually summing raw balances.',
      inputSchema: z.object({}),
      handler: async () => {
        const friends = await client.getFriends();
    
        const owesYou: Array<{ name: string; amount: number; currency: string }> = [];
        const youOwe: Array<{ name: string; amount: number; currency: string }> = [];
        let net = 0;
    
        for (const f of friends) {
          const name = `${f.first_name} ${f.last_name}`.trim();
          for (const b of f.balance) {
            const amount = parseFloat(b.amount);
            if (isNaN(amount) || amount === 0) continue;
            if (amount > 0) {
              owesYou.push({ name, amount, currency: b.currency_code });
              net += amount;
            } else {
              youOwe.push({ name, amount: Math.abs(amount), currency: b.currency_code });
              net += amount;
            }
          }
        }
    
        return {
          owes_you: owesYou,
          you_owe: youOwe,
          net: Math.round(net * 100) / 100,
          summary:
            net > 0
              ? `Overall you are owed $${net.toFixed(2)}`
              : net < 0
                ? `Overall you owe $${Math.abs(net).toFixed(2)}`
                : 'All settled up!',
        };
      },
    },
Behavior3/5

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

No annotations provided so description carries full burden. Adds critical behavioral trait 'pre-computed' (caching) and performance characteristics. Omits data freshness/staleness details, read-only safety confirmation, or permission requirements—gaps expected for a zero-annotation tool.

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?

Two sentences with zero redundancy: first defines output content (three components), second establishes performance advantage. Front-loaded with specific resource identification.

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

Completeness4/5

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

No output schema exists, but description compensates by detailing return content structure ('who owes you, who you owe, overall net position'). Omits specific data types or nesting, but appropriate for simple aggregation tool with zero inputs.

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

Parameters4/5

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

Zero parameters present, setting baseline per rubric. Description confirms absence of filtering by specifying 'across all friends', aligning empty schema with universal scope.

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

Purpose5/5

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

Specific verb 'Get' + resource 'net balance summary' with concrete scope 'across all friends'. Clearly distinguishes from sibling get_expenses (raw transactions vs pre-computed aggregates) and get_friends (basic metadata vs financial balances) via 'pre-computed' and 'net position' language.

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

Usage Guidelines4/5

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

Provides clear performance context ('Much faster than manually summing raw balances') implying when to use this cached view versus calculating from get_expenses. Lacks explicit 'when not to use' or named sibling alternative, positioning it between implied usage and explicit alternatives.

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/SaharshPatel24/splitwise-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server