Expense

Personal expense tracker: capture receipts, log IRS mileage, reconcile statements, export reports.

我该使用它吗

质量与安全性

A
描述质量
97%
模式完整度
75%
命名质量
94%
投毒风险
100%
权限匹配度
100%
协议合规性
100%

基于对工具定义和协议合规性的自动分析。

上下文开销

~5,623token 数(工具定义)
~3.8 KB典型响应大小
对注意力有显著影响(占 128k 上下文窗口的 4.39%)

这是每次将服务器的工具加载到模型上下文窗口时所消耗的大致 token 数。数值越高,可用于其他任务的注意力就越少。

安装

一键安装

将以下内容添加到你的 `claude_desktop_config.json` 文件中:

{
  "mcpServers": {
    "expense": {
      "url": "https://expense.labnotes.org/mcp"
    }
  }
}

远程端点

https://expense.labnotes.org/mcpstreamable-http

它能做什么

工具清单

工具(14)

🟢 只读🟡 写入🔴 删除⚪ 未知
🟡capture_receipt(imageData, mime, filename, url, merchant, ...)

Capture a receipt from a base64 image/PDF or a URL: extract the merchant, amount and category (reusing the merchant's previous category when known), store the image, and create the expense. A non-USD amount is converted to USD at the ECB reference rate for the expense date. Returns the extracted fields and the new expense id.

输入模式

{
  "type": "object",
  "properties": {
    "imageData": {
      "description": "Base64-encoded receipt image (PNG/JPEG/HEIC/WebP) or PDF bytes.",
      "type": "string"
    },
    "mime": {
      "description": "MIME type of imageData, e.g. image/png or application/pdf. Guessed from filename when omitted.",
      "type": "string"
    },
    "filename": {
      "description": "Original filename; used for the stored image name.",
      "type": "string"
    },
    "url": {
      "description": "URL of a receipt image or PDF to fetch instead of imageData.",
      "type": "string"
    },
    "merchant": {
      "description": "Merchant override (otherwise extracted).",
      "type": "string"
    },
    "amount": {
      "description": "Amount as a decimal string in `currency`, e.g. \"42.50\" (otherwise extracted).",
      "type": "string"
    },
    "currency": {
      "description": "ISO 4217 code of the amount's currency, e.g. \"EUR\". Defaults to the currency extracted from the receipt, else USD. A non-USD amount is stored as its USD conversion.",
      "type": "string"
    },
    "category": {
      "description": "Category override (otherwise resolved from the merchant's history, then the extraction suggestion).",
      "type": "string"
    },
    "date": {
      "description": "Expense date YYYY-MM-DD. Omitted dates the expense today in UTC, per the server instructions.",
      "type": "string",
      "format": "date",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
    },
    "report": {
      "description": "Report name to file under.",
      "type": "string"
    },
    "description": {
      "description": "Description or memo.",
      "type": "string"
    }
  },
  "$schema": "https://json-schema.org/draft/2020-12/schema"
}

输出模式

{
  "type": "object",
  "properties": {
    "captured": {
      "type": "boolean",
      "description": "False when the image was already filed."
    },
    "serverUtcNow": {
      "type": "string",
      "description": "The server clock, ISO instant."
    },
    "expenseId": {
      "type": "string"
    },
    "duplicate": {
      "type": "boolean"
    },
    "duplicateOf": {
      "type": [
        "string",
        "null"
      ]
    },
    "extracted": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "isReceipt": {
              "type": "boolean"
            },
            "merchant": {
              "type": "string"
            },
            "amount": {
              "type": "string"
            },
            "currency": {
              "type": "string"
            },
            "category": {
              "type": "string"
            },
            "confidence": {
              "type": "string",
              "enum": [
                "high",
                "medium",
                "low"
              ]
            },
            "notes": {
              "type": "string"
            }
          },
          "required": [
            "isReceipt",
            "merchant",
            "amount",
            "currency",
            "category",
            "confidence",
            "notes"
          ],
          "additionalProperties": false
        },
        {
          "type": "null"
        }
      ]
    },
    "resolved": {
      "type": "object",
      "properties": {
        "merchant": {
          "type": "string"
        },
        "amount": {
          "type": "string"
        },
        "category": {
          "type": "string"
        },
        "date": {
          "type": "string"
        },
        "report": {
          "type": "string"
        }
      },
      "required": [
        "merchant",
        "amount",
        "category",
        "date",
        "report"
      ],
      "additionalProperties": false
    },
    "fx": {
      "type": "object",
      "properties": {
        "currency": {
          "type": "string"
        },
        "originalAmount": {
          "type": "string"
        },
        "amount": {
          "type": "string"
        },
        "fxRate": {
          "type": "string"
        },
        "rateDate": {
          "type": "string"
        }
      },
      "required": [
        "currency",
        "originalAmount",
        "amount",
        "fxRate",
        "rateDate"
      ],
      "additionalProperties": false
    },
    "warning": {
      "type": "string"
    }
  },
  "required": [
    "captured",
    "serverUtcNow"
  ],
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false
}
🟡log_mileage(locations, date, type, report, category, ...)

Log a driving trip: geocode the stops, compute the route distance and the amount at the IRS rate for the trip's date and type, and create the mileage expense. The trip runs one way, from the first stop to the last; pass roundTrip true when the drive returns to its first stop.

输入模式

{
  "type": "object",
  "properties": {
    "locations": {
      "minItems": 2,
      "maxItems": 12,
      "type": "array",
      "items": {
        "anyOf": [
          {
            "type": "string",
            "maxLength": 300,
            "description": "Address to geocode."
          },
          {
            "type": "object",
            "properties": {
              "address": {
                "type": "string",
                "maxLength": 300
              },
              "lat": {
                "description": "Pre-known latitude — skips geocoding.",
                "type": "number"
              },
              "lng": {
                "description": "Pre-known longitude — skips geocoding.",
                "type": "number"
              }
            },
            "required": [
              "address"
            ]
          }
        ]
      },
      "description": "Ordered trip stops: start, intermediate stops, end. Each is an address string or a pre-geocoded { address, lat, lng }."
    },
    "date": {
      "description": "Trip date YYYY-MM-DD. Omitted dates the trip today in UTC, per the server instructions.",
      "type": "string",
      "format": "date",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
    },
    "type": {
      "description": "IRS trip type — picks the rate for the trip's date (defaults to business).",
      "type": "string",
      "enum": [
        "business",
        "charity",
        "medical",
        "moving"
      ]
    },
    "report": {
      "description": "Report name to file under.",
      "type": "string"
    },
    "category": {
      "description": "Category name.",
      "type": "string"
    },
    "description": {
      "description": "Description or memo.",
      "type": "string"
    },
    "roundTrip": {
      "description": "One way by default: the trip starts at the first stop and ends at the last. Pass true when the drive returns to the first stop (a closed loop), which roughly doubles the distance for a there-and-back pair.",
      "type": "boolean"
    }
  },
  "required": [
    "locations"
  ],
  "$schema": "https://json-schema.org/draft/2020-12/schema"
}

输出模式

{
  "type": "object",
  "properties": {
    "logged": {
      "type": "boolean"
    },
    "expenseId": {
      "type": "string"
    },
    "stops": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "distanceMiles": {
      "type": "string"
    },
    "amount": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "enum": [
        "business",
        "charity",
        "medical",
        "moving"
      ]
    },
    "rate": {
      "description": "IRS rate used, null if none.",
      "type": [
        "string",
        "null"
      ]
    },
    "approximate": {
      "type": "boolean",
      "description": "Distance is straight-line, not routed."
    },
    "roundTrip": {
      "type": "boolean"
    },
    "note": {
      "type": "string"
    }
  },
  "required": [
    "logged",
    "expenseId",
    "stops",
    "distanceMiles",
    "amount",
    "type",
    "rate",
    "approximate",
    "roundTrip"
  ],
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false
}
🟢list_expenses(dateFrom, dateTo, category, merchant, report, ...)

Query expenses with optional filters (date range, category, merchant, report, unreported-only, type). Returns newest first. Amounts are decimal strings.

输入模式

{
  "type": "object",
  "properties": {
    "dateFrom": {
      "description": "Inclusive start date YYYY-MM-DD.",
      "type": "string",
      "format": "date",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
    },
    "dateTo": {
      "description": "Inclusive end date YYYY-MM-DD.",
      "type": "string",
      "format": "date",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
    },
    "category": {
      "description": "Exact category name (case-insensitive).",
      "type": "string"
    },
    "merchant": {
      "description": "Substring match on merchant (receipts) or stop addresses (mileage).",
      "type": "string"
    },
    "report": {
      "description": "Exact report name.",
      "type": "string"
    },
    "unreported": {
      "description": "Only expenses not in any report.",
      "type": "boolean"
    },
    "type": {
      "type": "string",
      "enum": [
        "receipt",
        "mileage"
      ]
    },
    "limit": {
      "description": "Max rows (default 100).",
      "type": "integer",
      "minimum": 1,
      "maximum": 500
    }
  },
  "$schema": "https://json-schema.org/draft/2020-12/schema"
}

输出模式

{
  "type": "object",
  "properties": {
    "count": {
      "type": "number",
      "description": "Matches before the limit."
    },
    "returned": {
      "type": "number",
      "description": "Rows in `expenses`."
    },
    "expenses": {
      "type": "array",
      "items": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "type": {
                "type": "string",
                "const": "receipt"
              },
              "date": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "report": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "category": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "description": {
                "type": "string"
              },
              "amount": {
                "description": "USD, decimal string.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "merchant": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "currency": {
                "type": "string"
              },
              "originalAmount": {
                "description": "Printed amount in `currency`, null for a USD receipt.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "fxRate": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "createdAt": {
                "type": "string"
              },
              "updatedAt": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "type",
              "date",
              "report",
              "category",
              "description",
              "amount",
              "merchant",
              "currency",
              "originalAmount",
              "fxRate",
              "createdAt",
              "updatedAt"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "type": {
                "type": "string",
                "const": "mileage"
              },
              "date": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "report": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "category": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "description": {
                "type": "string"
              },
              "amount": {
                "description": "USD, decimal string.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "mileageType": {
                "type": "string",
                "enum": [
                  "business",
                  "charity",
                  "medical",
                  "moving"
                ]
              },
              "distanceMiles": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "stops": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "createdAt": {
                "type": "string"
              },
              "updatedAt": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "type",
              "date",
              "report",
              "category",
              "description",
              "amount",
              "mileageType",
              "distanceMiles",
              "stops",
              "createdAt",
              "updatedAt"
            ],
            "additionalProperties": false
          }
        ]
      }
    }
  },
  "required": [
    "count",
    "returned",
    "expenses"
  ],
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false
}
🟢expense_summary(dateFrom, dateTo, category, merchant, report, ...)

Totals for expenses matching the filters: overall count + sum, and per-category breakdown. The answer to "how much did I spend on X?".

输入模式

{
  "type": "object",
  "properties": {
    "dateFrom": {
      "description": "Inclusive start date YYYY-MM-DD.",
      "type": "string",
      "format": "date",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
    },
    "dateTo": {
      "description": "Inclusive end date YYYY-MM-DD.",
      "type": "string",
      "format": "date",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
    },
    "category": {
      "description": "Exact category name (case-insensitive).",
      "type": "string"
    },
    "merchant": {
      "description": "Substring match on merchant (receipts) or stop addresses (mileage).",
      "type": "string"
    },
    "report": {
      "description": "Exact report name.",
      "type": "string"
    },
    "unreported": {
      "description": "Only expenses not in any report.",
      "type": "boolean"
    },
    "type": {
      "type": "string",
      "enum": [
        "receipt",
        "mileage"
      ]
    }
  },
  "$schema": "https://json-schema.org/draft/2020-12/schema"
}

输出模式

{
  "type": "object",
  "properties": {
    "count": {
      "type": "number"
    },
    "total": {
      "type": "string",
      "description": "Exact USD total, 2 decimals."
    },
    "byCategory": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "category": {
            "type": "string"
          },
          "count": {
            "type": "number"
          },
          "total": {
            "type": "string"
          }
        },
        "required": [
          "category",
          "count",
          "total"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "count",
    "total",
    "byCategory"
  ],
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false
}
🟢list_reports

All reports with their expense counts and exact totals.

输入模式

{
  "type": "object",
  "properties": {},
  "$schema": "https://json-schema.org/draft/2020-12/schema"
}

输出模式

{
  "type": "object",
  "properties": {
    "result": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "closed": {
            "type": "boolean"
          },
          "count": {
            "type": "number"
          },
          "total": {
            "type": "string"
          }
        },
        "required": [
          "name",
          "closed",
          "count",
          "total"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "result"
  ],
  "$schema": "https://json-schema.org/draft/2020-12/schema"
}
🟡create_report(name)

Create a report (e.g. "Q3 2026") to group expenses. Fails if the name already exists.

输入模式

{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "minLength": 1,
      "description": "Report name."
    }
  },
  "required": [
    "name"
  ],
  "$schema": "https://json-schema.org/draft/2020-12/schema"
}

输出模式

{
  "type": "object",
  "properties": {
    "name": {
      "type": "string"
    }
  },
  "required": [
    "name"
  ],
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false
}
⚪close_report(name, closed, confirm)

Close (or reopen) a report. A closed report refuses every expense filed to it until it is reopened, so closing asks the user to confirm first; a client that cannot answer the prompt passes confirm: true. Reopening needs no confirmation.

输入模式

{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "minLength": 1
    },
    "closed": {
      "description": "Default true.",
      "type": "boolean"
    },
    "confirm": {
      "description": "Confirmation for closing, for clients that cannot answer the interactive prompt.",
      "type": "boolean"
    }
  },
  "required": [
    "name"
  ],
  "$schema": "https://json-schema.org/draft/2020-12/schema"
}

输出模式

{
  "type": "object",
  "properties": {
    "name": {
      "type": "string"
    },
    "closed": {
      "type": "boolean"
    }
  },
  "required": [
    "name",
    "closed"
  ],
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false
}
🟡add_to_report(expenseId, report)

Move an expense into a report. Also renames the stored receipt image to the dated convention name when the expense has a date and original filename.

输入模式

{
  "type": "object",
  "properties": {
    "expenseId": {
      "type": "string",
      "minLength": 1
    },
    "report": {
      "type": "string",
      "minLength": 1,
      "description": "Report name."
    }
  },
  "required": [
    "expenseId",
    "report"
  ],
  "$schema": "https://json-schema.org/draft/2020-12/schema"
}

输出模式

{
  "type": "object",
  "properties": {
    "expenseId": {
      "type": "string"
    },
    "report": {
      "type": "string"
    }
  },
  "required": [
    "expenseId",
    "report"
  ],
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false
}
🟢export_report(name)

Render a report as a PDF (the same layout as the web export: grouped by category, mileage rows with type/rate/distance, and a 'Receipts & routes' appendix — receipt images plus a real route map per mileage trip with its date, mileage, and amount listed beside it) and return it base64-encoded. Decode and save as a .pdf file.

输入模式

{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "minLength": 1,
      "description": "Report name."
    }
  },
  "required": [
    "name"
  ],
  "$schema": "https://json-schema.org/draft/2020-12/schema"
}

输出模式

{
  "type": "object",
  "properties": {
    "filename": {
      "type": "string"
    },
    "mime": {
      "type": "string"
    },
    "sizeBytes": {
      "type": "number"
    },
    "base64": {
      "type": "string"
    },
    "note": {
      "type": "string"
    }
  },
  "required": [
    "filename",
    "mime",
    "sizeBytes",
    "base64",
    "note"
  ],
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false
}
🟢list_categories

The account's category names (alphabetical) — use these when categorizing expenses.

输入模式

{
  "type": "object",
  "properties": {},
  "$schema": "https://json-schema.org/draft/2020-12/schema"
}

输出模式

{
  "type": "object",
  "properties": {
    "result": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "array",
      "items": {
        "type": "string"
      }
    }
  },
  "required": [
    "result"
  ],
  "$schema": "https://json-schema.org/draft/2020-12/schema"
}
🟢list_merchants

Merchant names previously used, most recent first.

输入模式

{
  "type": "object",
  "properties": {},
  "$schema": "https://json-schema.org/draft/2020-12/schema"
}

输出模式

{
  "type": "object",
  "properties": {
    "result": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "array",
      "items": {
        "type": "string"
      }
    }
  },
  "required": [
    "result"
  ],
  "$schema": "https://json-schema.org/draft/2020-12/schema"
}
🟢get_settings

Account settings: the home address (start and end of every trip), the account's named locations, and the IRS mileage-rate master table (period + type).

输入模式

{
  "type": "object",
  "properties": {},
  "$schema": "https://json-schema.org/draft/2020-12/schema"
}

输出模式

{
  "type": "object",
  "properties": {
    "mileageRates": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "business",
              "charity",
              "medical",
              "moving"
            ]
          },
          "startDate": {
            "type": "string"
          },
          "endDate": {
            "type": "string"
          },
          "rate": {
            "type": "string"
          }
        },
        "required": [
          "type",
          "startDate",
          "endDate",
          "rate"
        ],
        "additionalProperties": false
      }
    },
    "homeAddress": {
      "type": "string"
    },
    "locations": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "address": {
            "type": "string"
          }
        },
        "required": [
          "name",
          "address"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "mileageRates",
    "homeAddress",
    "locations"
  ],
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false
}
🟢reconcile(statementCsv)

Match a bank statement against logged expenses. Pass the statement as CSV or QFX/OFX text (CSV: header row optional, date/description/amount columns, signed amounts or Debit/Credit split; QFX/OFX: FITID honored). Returns matched pairs (high confidence), statement lines needing review (amount+date match but merchant differs, or ambiguous), statement lines with no matching receipt, and logged receipts with no statement line. Refund/credit lines and already-reconciled receipts are never auto-matched.

输入模式

{
  "type": "object",
  "properties": {
    "statementCsv": {
      "type": "string",
      "minLength": 1,
      "maxLength": 2000000
    }
  },
  "required": [
    "statementCsv"
  ],
  "$schema": "https://json-schema.org/draft/2020-12/schema"
}

输出模式

{
  "type": "object",
  "properties": {
    "statementLines": {
      "type": "number"
    },
    "matched": {
      "type": "number"
    },
    "matchedPairs": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "line": {
            "type": "number"
          },
          "date": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "statementAmount": {
            "type": "string"
          },
          "expenseId": {
            "type": "string"
          },
          "merchant": {
            "type": "string"
          },
          "expenseAmount": {
            "type": "string"
          },
          "confidence": {
            "type": "string",
            "const": "high"
          }
        },
        "required": [
          "line",
          "date",
          "description",
          "statementAmount",
          "expenseId",
          "merchant",
          "expenseAmount",
          "confidence"
        ],
        "additionalProperties": false
      }
    },
    "needsReview": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "line": {
            "type": "number"
          },
          "date": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "statementAmount": {
            "type": "string"
          },
          "reasons": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "candidates": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "expenseId": {
                  "type": "string"
                },
                "merchant": {
                  "type": "string"
                },
                "expenseAmount": {
                  "type": "string"
                }
              },
              "required": [
                "expenseId",
                "merchant",
                "expenseAmount"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "line",
          "date",
          "description",
          "statementAmount",
          "reasons",
          "candidates"
        ],
        "additionalProperties": false
      }
    },
    "unmatchedLines": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "line": {
            "type": "number"
          },
          "date": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "amount": {
            "type": "string"
          }
        },
        "required": [
          "line",
          "date",
          "description",
          "amount"
        ],
        "additionalProperties": false
      }
    },
    "unmatchedExpenses": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "date": {
            "type": "string"
          },
          "merchant": {
            "type": "string"
          },
          "amount": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "date",
          "merchant",
          "amount"
        ],
        "additionalProperties": false
      }
    },
    "skippedLines": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "line": {
            "type": "number"
          },
          "raw": {
            "type": "string"
          },
          "reason": {
            "type": "string"
          }
        },
        "required": [
          "line",
          "raw",
          "reason"
        ],
        "additionalProperties": false
      }
    },
    "note": {
      "type": "string"
    }
  },
  "required": [
    "statementLines",
    "matched",
    "matchedPairs",
    "needsReview",
    "unmatchedLines",
    "unmatchedExpenses",
    "skippedLines",
    "note"
  ],
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false
}
⚪apply_reconciliation(statementCsv, matches, additions, fileName, confirm)

Apply what a person accepted from `reconcile` and complete the run. `matches` are `{ line, expenseId }` pairs (a matched pair's line, or a review candidate) and are re-checked against a fresh match, so only an expense the statement supports for that line is accepted. `additions` are the lines with no expense behind them, filed as new expenses from the statement's own date and amount; a refund line cannot be added. Nothing is written if any row fails. Asks the user to confirm first; a client that cannot answer the prompt passes confirm: true.

输入模式

{
  "type": "object",
  "properties": {
    "statementCsv": {
      "type": "string",
      "minLength": 1,
      "maxLength": 2000000
    },
    "matches": {
      "description": "Accepted lines that have an expense behind them.",
      "maxItems": 200,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "line": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991,
            "description": "1-based statement line number from reconcile."
          },
          "expenseId": {
            "type": "string",
            "minLength": 1,
            "description": "Expense id from the matched pair or a review candidate."
          }
        },
        "required": [
          "line",
          "expenseId"
        ]
      }
    },
    "additions": {
      "description": "Accepted lines with no expense behind them, to file as new expenses; date and amount come from the statement.",
      "maxItems": 200,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "line": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991,
            "description": "1-based statement line number from reconcile."
          },
          "merchant": {
            "description": "Merchant; defaults to the statement's description.",
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "category": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "description": {
            "type": "string",
            "maxLength": 1000
          },
          "report": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Open report to file it under; list_reports shows them."
          }
        },
        "required": [
          "line",
          "report"
        ]
      }
    },
    "fileName": {
      "description": "Label for the run; defaults to statement.csv.",
      "type": "string",
      "minLength": 1,
      "maxLength": 200
    },
    "confirm": {
      "description": "Confirmation for clients that cannot answer the interactive prompt.",
      "type": "boolean"
    }
  },
  "required": [
    "statementCsv"
  ],
  "$schema": "https://json-schema.org/draft/2020-12/schema"
}

输出模式

{
  "type": "object",
  "properties": {
    "matched": {
      "type": "number"
    },
    "created": {
      "type": "number"
    },
    "errors": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "createdExpenseIds": {
      "type": "array",
      "items": {
        "type": "string"
      }
    }
  },
  "required": [
    "matched",
    "created",
    "errors",
    "createdExpenseIds"
  ],
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false
}

社区

评价此服务器

证据

最近观测

已验证未记录版本14 个工具