274569bd79
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
43 lines
1.8 KiB
C#
43 lines
1.8 KiB
C#
using System.ComponentModel;
|
|
using ModelContextProtocol.Server;
|
|
|
|
namespace MoneyMap.Mcp.Tools;
|
|
|
|
[McpServerToolType]
|
|
public static class ReceiptTools
|
|
{
|
|
[McpServerTool(Name = "get_receipt_image"), Description("Get a receipt image for visual inspection. Returns the image as base64-encoded data. Useful for verifying transaction categories.")]
|
|
public static async Task<string> GetReceiptImage(
|
|
[Description("Receipt ID")] long receiptId,
|
|
MoneyMapApiClient api = default!)
|
|
{
|
|
return await api.GetReceiptImageAsync(receiptId);
|
|
}
|
|
|
|
[McpServerTool(Name = "get_receipt_text"), Description("Get already-parsed receipt data as structured text. Avoids re-analyzing the image when parse data exists.")]
|
|
public static async Task<string> GetReceiptText(
|
|
[Description("Receipt ID")] long receiptId,
|
|
MoneyMapApiClient api = default!)
|
|
{
|
|
return await api.GetReceiptTextAsync(receiptId);
|
|
}
|
|
|
|
[McpServerTool(Name = "list_receipts"), Description("List receipts with their parse status and basic info.")]
|
|
public static async Task<string> ListReceipts(
|
|
[Description("Filter by transaction ID")] long? transactionId = null,
|
|
[Description("Filter by parse status: NotRequested, Queued, Parsing, Completed, Failed")] string? parseStatus = null,
|
|
[Description("Max results (default 50)")] int? limit = null,
|
|
MoneyMapApiClient api = default!)
|
|
{
|
|
return await api.ListReceiptsAsync(transactionId, parseStatus, limit);
|
|
}
|
|
|
|
[McpServerTool(Name = "get_receipt_details"), Description("Get full receipt details including parsed data and all line items.")]
|
|
public static async Task<string> GetReceiptDetails(
|
|
[Description("Receipt ID")] long receiptId,
|
|
MoneyMapApiClient api = default!)
|
|
{
|
|
return await api.GetReceiptDetailsAsync(receiptId);
|
|
}
|
|
}
|