Skip to main content
Glama
SaharshPatel24

splitwise-mcp

create_expense

Create a new shared expense with explicit per-user splits in Splitwise. Specify description, cost, date, and individual payment details for accurate tracking.

Instructions

Create a new Splitwise expense with explicit per-user splits. Always confirm split details with the user before calling.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
descriptionYesExpense description e.g. "Dinner at Nobu"
costYesTotal cost as decimal string e.g. "42.50"
dateYesISO date e.g. 2025-03-15
currency_codeNoCurrency code e.g. USD, EUR (default USD)
group_idNoGroup ID if this is a group expense
usersYesAll involved users with their paid and owed shares

Implementation Reference

  • The actual implementation of the `createExpense` method in the `SplitwiseClient` class, which handles the API request to create an expense.
    async createExpense(params: CreateExpenseParams): Promise<SplitwiseExpense> {
      const body: Record<string, unknown> = {
        cost: params.cost,
        description: params.description,
        date: params.date,
        currency_code: params.currency_code ?? 'USD',
      };
      if (params.group_id !== undefined) body.group_id = params.group_id;
      params.users.forEach((u, i) => {
        body[`users__${i}__user_id`] = u.user_id;
        body[`users__${i}__paid_share`] = u.paid_share;
        body[`users__${i}__owed_share`] = u.owed_share;
      });
    
      const data = await this.post<{ expense: SplitwiseExpense }>('/create_expense', body);
      return data.expense;
    }
  • Type definition for the `createExpense` parameters.
    export interface CreateExpenseParams {
      cost: string;
      description: string;
      date: string;
      group_id?: number;
      currency_code?: string;
      users: Array<{ user_id: number; paid_share: string; owed_share: string }>;
    }
  • The MCP tool definition for `create_expense`, including the schema (using Zod) and the handler which calls the client's `createExpense` method.
      name: 'create_expense',
      description:
        'Create a new Splitwise expense with explicit per-user splits. Always confirm split details with the user before calling.',
      inputSchema: z.object({
        description: z.string().describe('Expense description e.g. "Dinner at Nobu"'),
        cost: z.string().describe('Total cost as decimal string e.g. "42.50"'),
        date: z.string().describe('ISO date e.g. 2025-03-15'),
        currency_code: z.string().optional().describe('Currency code e.g. USD, EUR (default USD)'),
        group_id: z.number().int().optional().describe('Group ID if this is a group expense'),
        users: z
          .array(
            z.object({
              user_id: z.number().int().describe('Splitwise user ID'),
              paid_share: z.string().describe('Amount this user paid e.g. "42.50"'),
              owed_share: z.string().describe('Amount this user owes e.g. "21.25"'),
            }),
          )
          .min(2)
          .describe('All involved users with their paid and owed shares'),
      }),
      handler: async (args: {
        description: string;
        cost: string;
        date: string;
        currency_code?: string;
        group_id?: number;
        users: Array<{ user_id: number; paid_share: string; owed_share: string }>;
      }) => {
        return client.createExpense(args);
      },
    },
Behavior3/5

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

No annotations provided, so description carries full burden. Contains 'confirm before calling' hinting at irreversibility/sensitivity, but omits specific side effects (balance mutations, group notifications, permanence) and error behaviors.

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 waste. First states purpose, second states critical safety prerequisite. Appropriately front-loaded.

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

Completeness3/5

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

Mutation tool with rich schema (100% coverage) but no annotations or output schema. Safety guideline included, but lacks disclosure of return values, failure modes, and financial side effects expected for expense creation tools.

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?

Schema coverage is 100%, establishing baseline 3. Description adds conceptual context ('explicit per-user splits') aligning with the complex users array structure, but does not add syntax, format constraints, or examples beyond schema.

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?

Clear verb ('Create') and resource ('Splitwise expense') with specific differentiator ('explicit per-user splits'). Lacks explicit differentiation from siblings, though no siblings create expenses.

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 explicit prerequisite action ('Always confirm split details with the user before calling'), indicating sensitive/high-stakes usage. Does not specify when to use alternatives or exclusion criteria.

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