@stupidcodefactory/freeagent-mcp-server 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +187 -0
- package/dist/api/freeagent-client.d.ts +12 -0
- package/dist/api/freeagent-client.d.ts.map +1 -0
- package/dist/api/freeagent-client.js +114 -0
- package/dist/api/freeagent-client.js.map +1 -0
- package/dist/api/index.d.ts +7 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +4 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/rate-limiter.d.ts +15 -0
- package/dist/api/rate-limiter.d.ts.map +1 -0
- package/dist/api/rate-limiter.js +62 -0
- package/dist/api/rate-limiter.js.map +1 -0
- package/dist/api/retry-handler.d.ts +14 -0
- package/dist/api/retry-handler.d.ts.map +1 -0
- package/dist/api/retry-handler.js +49 -0
- package/dist/api/retry-handler.js.map +1 -0
- package/dist/auth/index.d.ts +7 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +4 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/oauth.d.ts +16 -0
- package/dist/auth/oauth.d.ts.map +1 -0
- package/dist/auth/oauth.js +64 -0
- package/dist/auth/oauth.js.map +1 -0
- package/dist/auth/token-manager.d.ts +10 -0
- package/dist/auth/token-manager.d.ts.map +1 -0
- package/dist/auth/token-manager.js +71 -0
- package/dist/auth/token-manager.js.map +1 -0
- package/dist/auth/token-store.d.ts +10 -0
- package/dist/auth/token-store.d.ts.map +1 -0
- package/dist/auth/token-store.js +84 -0
- package/dist/auth/token-store.js.map +1 -0
- package/dist/config.d.ts +73 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +46 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +44 -0
- package/dist/index.js.map +1 -0
- package/dist/prompts/cash-flow-forecast.d.ts +12 -0
- package/dist/prompts/cash-flow-forecast.d.ts.map +1 -0
- package/dist/prompts/cash-flow-forecast.js +93 -0
- package/dist/prompts/cash-flow-forecast.js.map +1 -0
- package/dist/prompts/index.d.ts +8 -0
- package/dist/prompts/index.d.ts.map +1 -0
- package/dist/prompts/index.js +8 -0
- package/dist/prompts/index.js.map +1 -0
- package/dist/prompts/invoice-from-description.d.ts +12 -0
- package/dist/prompts/invoice-from-description.d.ts.map +1 -0
- package/dist/prompts/invoice-from-description.js +49 -0
- package/dist/prompts/invoice-from-description.js.map +1 -0
- package/dist/prompts/monthly-expense-summary.d.ts +12 -0
- package/dist/prompts/monthly-expense-summary.d.ts.map +1 -0
- package/dist/prompts/monthly-expense-summary.js +84 -0
- package/dist/prompts/monthly-expense-summary.js.map +1 -0
- package/dist/prompts/overdue-invoice-followup.d.ts +12 -0
- package/dist/prompts/overdue-invoice-followup.d.ts.map +1 -0
- package/dist/prompts/overdue-invoice-followup.js +63 -0
- package/dist/prompts/overdue-invoice-followup.js.map +1 -0
- package/dist/prompts/project-profitability.d.ts +12 -0
- package/dist/prompts/project-profitability.d.ts.map +1 -0
- package/dist/prompts/project-profitability.js +103 -0
- package/dist/prompts/project-profitability.js.map +1 -0
- package/dist/prompts/quarterly-tax-estimate.d.ts +12 -0
- package/dist/prompts/quarterly-tax-estimate.d.ts.map +1 -0
- package/dist/prompts/quarterly-tax-estimate.js +132 -0
- package/dist/prompts/quarterly-tax-estimate.js.map +1 -0
- package/dist/prompts/transaction-categorization.d.ts +12 -0
- package/dist/prompts/transaction-categorization.d.ts.map +1 -0
- package/dist/prompts/transaction-categorization.js +81 -0
- package/dist/prompts/transaction-categorization.js.map +1 -0
- package/dist/resources/bank-accounts.d.ts +8 -0
- package/dist/resources/bank-accounts.d.ts.map +1 -0
- package/dist/resources/bank-accounts.js +34 -0
- package/dist/resources/bank-accounts.js.map +1 -0
- package/dist/resources/bank-transactions.d.ts +11 -0
- package/dist/resources/bank-transactions.d.ts.map +1 -0
- package/dist/resources/bank-transactions.js +34 -0
- package/dist/resources/bank-transactions.js.map +1 -0
- package/dist/resources/bills.d.ts +13 -0
- package/dist/resources/bills.d.ts.map +1 -0
- package/dist/resources/bills.js +38 -0
- package/dist/resources/bills.js.map +1 -0
- package/dist/resources/categories.d.ts +4 -0
- package/dist/resources/categories.d.ts.map +1 -0
- package/dist/resources/categories.js +21 -0
- package/dist/resources/categories.js.map +1 -0
- package/dist/resources/company.d.ts +3 -0
- package/dist/resources/company.d.ts.map +1 -0
- package/dist/resources/company.js +12 -0
- package/dist/resources/company.js.map +1 -0
- package/dist/resources/contacts.d.ts +9 -0
- package/dist/resources/contacts.d.ts.map +1 -0
- package/dist/resources/contacts.js +37 -0
- package/dist/resources/contacts.js.map +1 -0
- package/dist/resources/expenses.d.ts +12 -0
- package/dist/resources/expenses.d.ts.map +1 -0
- package/dist/resources/expenses.js +36 -0
- package/dist/resources/expenses.js.map +1 -0
- package/dist/resources/index.d.ts +20 -0
- package/dist/resources/index.d.ts.map +1 -0
- package/dist/resources/index.js +12 -0
- package/dist/resources/index.js.map +1 -0
- package/dist/resources/invoices.d.ts +14 -0
- package/dist/resources/invoices.d.ts.map +1 -0
- package/dist/resources/invoices.js +40 -0
- package/dist/resources/invoices.js.map +1 -0
- package/dist/resources/projects.d.ts +10 -0
- package/dist/resources/projects.d.ts.map +1 -0
- package/dist/resources/projects.js +39 -0
- package/dist/resources/projects.js.map +1 -0
- package/dist/resources/timeslips.d.ts +12 -0
- package/dist/resources/timeslips.d.ts.map +1 -0
- package/dist/resources/timeslips.js +36 -0
- package/dist/resources/timeslips.js.map +1 -0
- package/dist/resources/users.d.ts +5 -0
- package/dist/resources/users.d.ts.map +1 -0
- package/dist/resources/users.js +30 -0
- package/dist/resources/users.js.map +1 -0
- package/dist/server.d.ts +9 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +568 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/bank-tools.d.ts +112 -0
- package/dist/tools/bank-tools.d.ts.map +1 -0
- package/dist/tools/bank-tools.js +143 -0
- package/dist/tools/bank-tools.js.map +1 -0
- package/dist/tools/bill-tools.d.ts +129 -0
- package/dist/tools/bill-tools.d.ts.map +1 -0
- package/dist/tools/bill-tools.js +121 -0
- package/dist/tools/bill-tools.js.map +1 -0
- package/dist/tools/contact-tools.d.ts +147 -0
- package/dist/tools/contact-tools.d.ts.map +1 -0
- package/dist/tools/contact-tools.js +140 -0
- package/dist/tools/contact-tools.js.map +1 -0
- package/dist/tools/index.d.ts +13 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +13 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/invoice-tools.d.ts +171 -0
- package/dist/tools/invoice-tools.d.ts.map +1 -0
- package/dist/tools/invoice-tools.js +168 -0
- package/dist/tools/invoice-tools.js.map +1 -0
- package/dist/tools/project-tools.d.ts +117 -0
- package/dist/tools/project-tools.d.ts.map +1 -0
- package/dist/tools/project-tools.js +153 -0
- package/dist/tools/project-tools.js.map +1 -0
- package/dist/tools/query-tools.d.ts +91 -0
- package/dist/tools/query-tools.d.ts.map +1 -0
- package/dist/tools/query-tools.js +127 -0
- package/dist/tools/query-tools.js.map +1 -0
- package/dist/transformers/bank-transformer.d.ts +8 -0
- package/dist/transformers/bank-transformer.d.ts.map +1 -0
- package/dist/transformers/bank-transformer.js +46 -0
- package/dist/transformers/bank-transformer.js.map +1 -0
- package/dist/transformers/bill-transformer.d.ts +6 -0
- package/dist/transformers/bill-transformer.d.ts.map +1 -0
- package/dist/transformers/bill-transformer.js +34 -0
- package/dist/transformers/bill-transformer.js.map +1 -0
- package/dist/transformers/category-transformer.d.ts +5 -0
- package/dist/transformers/category-transformer.d.ts.map +1 -0
- package/dist/transformers/category-transformer.js +14 -0
- package/dist/transformers/category-transformer.js.map +1 -0
- package/dist/transformers/common.d.ts +7 -0
- package/dist/transformers/common.d.ts.map +1 -0
- package/dist/transformers/common.js +33 -0
- package/dist/transformers/common.js.map +1 -0
- package/dist/transformers/company-transformer.d.ts +4 -0
- package/dist/transformers/company-transformer.d.ts.map +1 -0
- package/dist/transformers/company-transformer.js +10 -0
- package/dist/transformers/company-transformer.js.map +1 -0
- package/dist/transformers/contact-transformer.d.ts +5 -0
- package/dist/transformers/contact-transformer.d.ts.map +1 -0
- package/dist/transformers/contact-transformer.js +18 -0
- package/dist/transformers/contact-transformer.js.map +1 -0
- package/dist/transformers/expense-transformer.d.ts +5 -0
- package/dist/transformers/expense-transformer.d.ts.map +1 -0
- package/dist/transformers/expense-transformer.js +19 -0
- package/dist/transformers/expense-transformer.js.map +1 -0
- package/dist/transformers/index.d.ts +11 -0
- package/dist/transformers/index.d.ts.map +1 -0
- package/dist/transformers/index.js +11 -0
- package/dist/transformers/index.js.map +1 -0
- package/dist/transformers/invoice-transformer.d.ts +6 -0
- package/dist/transformers/invoice-transformer.d.ts.map +1 -0
- package/dist/transformers/invoice-transformer.js +39 -0
- package/dist/transformers/invoice-transformer.js.map +1 -0
- package/dist/transformers/project-transformer.d.ts +9 -0
- package/dist/transformers/project-transformer.d.ts.map +1 -0
- package/dist/transformers/project-transformer.js +53 -0
- package/dist/transformers/project-transformer.js.map +1 -0
- package/dist/transformers/user-transformer.d.ts +5 -0
- package/dist/transformers/user-transformer.d.ts.map +1 -0
- package/dist/transformers/user-transformer.js +14 -0
- package/dist/transformers/user-transformer.js.map +1 -0
- package/dist/types/freeagent/index.d.ts +256 -0
- package/dist/types/freeagent/index.d.ts.map +1 -0
- package/dist/types/freeagent/index.js +3 -0
- package/dist/types/freeagent/index.js.map +1 -0
- package/dist/types/llm/index.d.ts +159 -0
- package/dist/types/llm/index.d.ts.map +1 -0
- package/dist/types/llm/index.js +3 -0
- package/dist/types/llm/index.js.map +1 -0
- package/dist/utils/error-handler.d.ts +11 -0
- package/dist/utils/error-handler.d.ts.map +1 -0
- package/dist/utils/error-handler.js +57 -0
- package/dist/utils/error-handler.js.map +1 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +5 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/sanitizer.d.ts +4 -0
- package/dist/utils/sanitizer.d.ts.map +1 -0
- package/dist/utils/sanitizer.js +42 -0
- package/dist/utils/sanitizer.js.map +1 -0
- package/dist/utils/validators.d.ts +19 -0
- package/dist/utils/validators.d.ts.map +1 -0
- package/dist/utils/validators.js +83 -0
- package/dist/utils/validators.js.map +1 -0
- package/dist/utils/zod-to-json-schema.d.ts +24 -0
- package/dist/utils/zod-to-json-schema.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema.js +141 -0
- package/dist/utils/zod-to-json-schema.js.map +1 -0
- package/package.json +48 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
export const monthlyExpenseSummaryPrompt = {
|
|
2
|
+
name: 'monthly_expense_summary',
|
|
3
|
+
description: 'Generate a comprehensive expense analysis for a specified month',
|
|
4
|
+
arguments: [
|
|
5
|
+
{
|
|
6
|
+
name: 'month',
|
|
7
|
+
description: 'Month number (1-12)',
|
|
8
|
+
required: true,
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
name: 'year',
|
|
12
|
+
description: 'Year (YYYY)',
|
|
13
|
+
required: true,
|
|
14
|
+
},
|
|
15
|
+
],
|
|
16
|
+
};
|
|
17
|
+
export function getMonthlyExpenseSummaryMessages(month, year) {
|
|
18
|
+
const monthNum = parseInt(month, 10);
|
|
19
|
+
const yearNum = parseInt(year, 10);
|
|
20
|
+
// Calculate date range
|
|
21
|
+
const startDate = `${year}-${month.padStart(2, '0')}-01`;
|
|
22
|
+
const lastDay = new Date(yearNum, monthNum, 0).getDate();
|
|
23
|
+
const endDate = `${year}-${month.padStart(2, '0')}-${lastDay}`;
|
|
24
|
+
// Previous month for comparison
|
|
25
|
+
const prevMonth = monthNum === 1 ? 12 : monthNum - 1;
|
|
26
|
+
const prevYear = monthNum === 1 ? yearNum - 1 : yearNum;
|
|
27
|
+
const prevStartDate = `${prevYear}-${prevMonth.toString().padStart(2, '0')}-01`;
|
|
28
|
+
const prevLastDay = new Date(prevYear, prevMonth, 0).getDate();
|
|
29
|
+
const prevEndDate = `${prevYear}-${prevMonth.toString().padStart(2, '0')}-${prevLastDay}`;
|
|
30
|
+
const messages = [
|
|
31
|
+
{
|
|
32
|
+
role: 'user',
|
|
33
|
+
content: {
|
|
34
|
+
type: 'text',
|
|
35
|
+
text: `Analyze expenses for ${monthNum}/${yearNum}. Include:
|
|
36
|
+
1. Total expenses by category
|
|
37
|
+
2. Top 5 vendors by spend
|
|
38
|
+
3. Month-over-month comparison with ${prevMonth}/${prevYear}
|
|
39
|
+
4. Flag any unusual expenses (>2x average)
|
|
40
|
+
5. Tax-deductible totals
|
|
41
|
+
|
|
42
|
+
Please read the expense and bill data from the resources and provide a comprehensive analysis.`,
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
role: 'user',
|
|
47
|
+
content: {
|
|
48
|
+
type: 'resource',
|
|
49
|
+
resource: {
|
|
50
|
+
uri: `freeagent://expenses?from_date=${startDate}&to_date=${endDate}`,
|
|
51
|
+
mimeType: 'application/json',
|
|
52
|
+
text: `Fetch expenses from ${startDate} to ${endDate}`,
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
role: 'user',
|
|
58
|
+
content: {
|
|
59
|
+
type: 'resource',
|
|
60
|
+
resource: {
|
|
61
|
+
uri: `freeagent://bills?from_date=${startDate}&to_date=${endDate}`,
|
|
62
|
+
mimeType: 'application/json',
|
|
63
|
+
text: `Fetch bills from ${startDate} to ${endDate}`,
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
role: 'user',
|
|
69
|
+
content: {
|
|
70
|
+
type: 'resource',
|
|
71
|
+
resource: {
|
|
72
|
+
uri: `freeagent://expenses?from_date=${prevStartDate}&to_date=${prevEndDate}`,
|
|
73
|
+
mimeType: 'application/json',
|
|
74
|
+
text: `Fetch previous month expenses for comparison`,
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
];
|
|
79
|
+
return {
|
|
80
|
+
description: `Monthly expense summary for ${monthNum}/${yearNum}`,
|
|
81
|
+
messages,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=monthly-expense-summary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"monthly-expense-summary.js","sourceRoot":"","sources":["../../src/prompts/monthly-expense-summary.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,IAAI,EAAE,yBAAyB;IAC/B,WAAW,EAAE,iEAAiE;IAC9E,SAAS,EAAE;QACT;YACE,IAAI,EAAE,OAAO;YACb,WAAW,EAAE,qBAAqB;YAClC,QAAQ,EAAE,IAAI;SACf;QACD;YACE,IAAI,EAAE,MAAM;YACZ,WAAW,EAAE,aAAa;YAC1B,QAAQ,EAAE,IAAI;SACf;KACF;CACF,CAAC;AAEF,MAAM,UAAU,gCAAgC,CAC9C,KAAa,EACb,IAAY;IAEZ,MAAM,QAAQ,GAAG,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACrC,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAEnC,uBAAuB;IACvB,MAAM,SAAS,GAAG,GAAG,IAAI,IAAI,KAAK,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,KAAK,CAAC;IACzD,MAAM,OAAO,GAAG,IAAI,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;IACzD,MAAM,OAAO,GAAG,GAAG,IAAI,IAAI,KAAK,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,OAAO,EAAE,CAAC;IAE/D,gCAAgC;IAChC,MAAM,SAAS,GAAG,QAAQ,KAAK,CAAC,CAAC,CAAC,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AM;YACZ,OAAO,EAAE;gBACP,IAAI,EAAE,UAAU;gBAChB,QAAQ,EAAE;oBACR,GAAG,EAAE,kCAAkC,aAAa,YAAY,WAAW,EAAE;oBAC7E,QAAQ,EAAE,kBAAkB;oBAC5B,IAAI,EAAE,8CAA8C;iBACrD;aACF;SACF;KACF,CAAC;IAEF,OAAO;QACL,WAAW,EAAE,+BAA+B,QAAQ,IAAI,OAAO,EAAE;QACjE,QAAQ;KACT,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { GetPromptResult } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
export declare const overdueInvoiceFollowupPrompt: {
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
arguments: {
|
|
6
|
+
name: string;
|
|
7
|
+
description: string;
|
|
8
|
+
required: boolean;
|
|
9
|
+
}[];
|
|
10
|
+
};
|
|
11
|
+
export declare function getOverdueInvoiceFollowupMessages(contactId?: string): GetPromptResult;
|
|
12
|
+
//# sourceMappingURL=overdue-invoice-followup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overdue-invoice-followup.d.ts","sourceRoot":"","sources":["../../src/prompts/overdue-invoice-followup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAiB,MAAM,oCAAoC,CAAC;AAEzF,eAAO,MAAM,4BAA4B;;;;;;;;CAUxC,CAAC;AAEF,wBAAgB,iCAAiC,CAC/C,SAAS,CAAC,EAAE,MAAM,GACjB,eAAe,CAoDjB"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
export const overdueInvoiceFollowupPrompt = {
|
|
2
|
+
name: 'overdue_invoice_followup',
|
|
3
|
+
description: 'Draft reminder emails for overdue invoices',
|
|
4
|
+
arguments: [
|
|
5
|
+
{
|
|
6
|
+
name: 'contact_id',
|
|
7
|
+
description: 'Optional: specific contact ID to filter by',
|
|
8
|
+
required: false,
|
|
9
|
+
},
|
|
10
|
+
],
|
|
11
|
+
};
|
|
12
|
+
export function getOverdueInvoiceFollowupMessages(contactId) {
|
|
13
|
+
const invoiceUri = contactId
|
|
14
|
+
? `freeagent://invoices?status=overdue&contact=${contactId}`
|
|
15
|
+
: 'freeagent://invoices?status=overdue';
|
|
16
|
+
const messages = [
|
|
17
|
+
{
|
|
18
|
+
role: 'user',
|
|
19
|
+
content: {
|
|
20
|
+
type: 'text',
|
|
21
|
+
text: `Review overdue invoices and help me draft follow-up emails.
|
|
22
|
+
|
|
23
|
+
For each overdue invoice:
|
|
24
|
+
1. Note how many days overdue
|
|
25
|
+
2. Check if there are previous invoices from this contact (payment history)
|
|
26
|
+
3. Draft an appropriate reminder email:
|
|
27
|
+
- 1-7 days: Friendly reminder
|
|
28
|
+
- 8-30 days: Firm but polite follow-up
|
|
29
|
+
- 30+ days: Escalation notice
|
|
30
|
+
|
|
31
|
+
Include the invoice reference, amount, and due date in each email draft.
|
|
32
|
+
${contactId ? `Focusing on contact ID: ${contactId}` : 'Show all overdue invoices grouped by contact.'}`,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
role: 'user',
|
|
37
|
+
content: {
|
|
38
|
+
type: 'resource',
|
|
39
|
+
resource: {
|
|
40
|
+
uri: invoiceUri,
|
|
41
|
+
mimeType: 'application/json',
|
|
42
|
+
text: 'Overdue invoices',
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
role: 'user',
|
|
48
|
+
content: {
|
|
49
|
+
type: 'resource',
|
|
50
|
+
resource: {
|
|
51
|
+
uri: 'freeagent://contacts?view=active',
|
|
52
|
+
mimeType: 'application/json',
|
|
53
|
+
text: 'Contact details for personalization',
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
];
|
|
58
|
+
return {
|
|
59
|
+
description: 'Overdue invoice follow-up emails',
|
|
60
|
+
messages,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=overdue-invoice-followup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overdue-invoice-followup.js","sourceRoot":"","sources":["../../src/prompts/overdue-invoice-followup.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC1C,IAAI,EAAE,0BAA0B;IAChC,WAAW,EAAE,4CAA4C;IACzD,SAAS,EAAE;QACT;YACE,IAAI,EAAE,YAAY;YAClB,WAAW,EAAE,4CAA4C;YACzD,QAAQ,EAAE,KAAK;SAChB;KACF;CACF,CAAC;AAEF,MAAM,UAAU,iCAAiC,CAC/C,SAAkB;IAElB,MAAM,UAAU,GAAG,SAAS;QAC1B,CAAC,CAAC,+CAA+C,SAAS,EAAE;QAC5D,CAAC,CAAC,qCAAqC,CAAC;IAE1C,MAAM,QAAQ,GAAoB;QAChC;YACE,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE;gBACP,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE;;;;;;;;;;;EAWZ,SAAS,CAAC,CAAC,CAAC,2BAA2B,SAAS,EAAE,CAAC,CAAC,CAAC,+CAA+C,EAAE;aACjG;SACF;QACD;YACE,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE;gBACP,IAAI,EAAE,UAAU;gBAChB,QAAQ,EAAE;oBACR,GAAG,EAAE,UAAU;oBACf,QAAQ,EAAE,kBAAkB;oBAC5B,IAAI,EAAE,kBAAkB;iBACzB;aACF;SACF;QACD;YACE,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE;gBACP,IAAI,EAAE,UAAU;gBAChB,QAAQ,EAAE;oBACR,GAAG,EAAE,kCAAkC;oBACvC,QAAQ,EAAE,kBAAkB;oBAC5B,IAAI,EAAE,qCAAqC;iBAC5C;aACF;SACF;KACF,CAAC;IAEF,OAAO;QACL,WAAW,EAAE,kCAAkC;QAC/C,QAAQ;KACT,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { GetPromptResult } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
export declare const projectProfitabilityPrompt: {
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
arguments: {
|
|
6
|
+
name: string;
|
|
7
|
+
description: string;
|
|
8
|
+
required: boolean;
|
|
9
|
+
}[];
|
|
10
|
+
};
|
|
11
|
+
export declare function getProjectProfitabilityMessages(projectId: string): GetPromptResult;
|
|
12
|
+
//# sourceMappingURL=project-profitability.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-profitability.d.ts","sourceRoot":"","sources":["../../src/prompts/project-profitability.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAiB,MAAM,oCAAoC,CAAC;AAEzF,eAAO,MAAM,0BAA0B;;;;;;;;CAUtC,CAAC;AAEF,wBAAgB,+BAA+B,CAC7C,SAAS,EAAE,MAAM,GAChB,eAAe,CA2FjB"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
export const projectProfitabilityPrompt = {
|
|
2
|
+
name: 'project_profitability',
|
|
3
|
+
description: 'Analyze profit margins and efficiency for a specific project',
|
|
4
|
+
arguments: [
|
|
5
|
+
{
|
|
6
|
+
name: 'project_id',
|
|
7
|
+
description: 'Project ID to analyze',
|
|
8
|
+
required: true,
|
|
9
|
+
},
|
|
10
|
+
],
|
|
11
|
+
};
|
|
12
|
+
export function getProjectProfitabilityMessages(projectId) {
|
|
13
|
+
const messages = [
|
|
14
|
+
{
|
|
15
|
+
role: 'user',
|
|
16
|
+
content: {
|
|
17
|
+
type: 'text',
|
|
18
|
+
text: `Analyze the profitability of project ${projectId}. Calculate:
|
|
19
|
+
|
|
20
|
+
1. Revenue Analysis:
|
|
21
|
+
- Total invoiced amount
|
|
22
|
+
- Outstanding invoices
|
|
23
|
+
- Average hourly/daily rate achieved
|
|
24
|
+
|
|
25
|
+
2. Cost Analysis:
|
|
26
|
+
- Time logged (hours × cost rate)
|
|
27
|
+
- Direct expenses
|
|
28
|
+
- Bills allocated to project
|
|
29
|
+
|
|
30
|
+
3. Profitability Metrics:
|
|
31
|
+
- Gross profit
|
|
32
|
+
- Profit margin percentage
|
|
33
|
+
- Budget vs actual comparison
|
|
34
|
+
- Efficiency (actual vs budgeted time)
|
|
35
|
+
|
|
36
|
+
4. Recommendations:
|
|
37
|
+
- Is the project on track?
|
|
38
|
+
- Areas for improvement
|
|
39
|
+
- Rate adjustment suggestions`,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
role: 'user',
|
|
44
|
+
content: {
|
|
45
|
+
type: 'resource',
|
|
46
|
+
resource: {
|
|
47
|
+
uri: `freeagent://projects/${projectId}`,
|
|
48
|
+
mimeType: 'application/json',
|
|
49
|
+
text: 'Project details',
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
role: 'user',
|
|
55
|
+
content: {
|
|
56
|
+
type: 'resource',
|
|
57
|
+
resource: {
|
|
58
|
+
uri: `freeagent://invoices?project=${projectId}`,
|
|
59
|
+
mimeType: 'application/json',
|
|
60
|
+
text: 'Project invoices',
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
role: 'user',
|
|
66
|
+
content: {
|
|
67
|
+
type: 'resource',
|
|
68
|
+
resource: {
|
|
69
|
+
uri: `freeagent://timeslips?project=${projectId}`,
|
|
70
|
+
mimeType: 'application/json',
|
|
71
|
+
text: 'Time logged against project',
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
role: 'user',
|
|
77
|
+
content: {
|
|
78
|
+
type: 'resource',
|
|
79
|
+
resource: {
|
|
80
|
+
uri: `freeagent://expenses?project=${projectId}`,
|
|
81
|
+
mimeType: 'application/json',
|
|
82
|
+
text: 'Project expenses',
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
role: 'user',
|
|
88
|
+
content: {
|
|
89
|
+
type: 'resource',
|
|
90
|
+
resource: {
|
|
91
|
+
uri: `freeagent://bills?project=${projectId}`,
|
|
92
|
+
mimeType: 'application/json',
|
|
93
|
+
text: 'Bills allocated to project',
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
];
|
|
98
|
+
return {
|
|
99
|
+
description: `Project profitability analysis for project ${projectId}`,
|
|
100
|
+
messages,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=project-profitability.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-profitability.js","sourceRoot":"","sources":["../../src/prompts/project-profitability.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,IAAI,EAAE,uBAAuB;IAC7B,WAAW,EAAE,8DAA8D;IAC3E,SAAS,EAAE;QACT;YACE,IAAI,EAAE,YAAY;YAClB,WAAW,EAAE,uBAAuB;YACpC,QAAQ,EAAE,IAAI;SACf;KACF;CACF,CAAC;AAEF,MAAM,UAAU,+BAA+B,CAC7C,SAAiB;IAEjB,MAAM,QAAQ,GAAoB;QAChC;YACE,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE;gBACP,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,wCAAwC,SAAS;;;;;;;;;;;;;;;;;;;;;iCAqB9B;aAC1B;SACF;QACD;YACE,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE;gBACP,IAAI,EAAE,UAAU;gBAChB,QAAQ,EAAE;oBACR,GAAG,EAAE,wBAAwB,SAAS,EAAE;oBACxC,QAAQ,EAAE,kBAAkB;oBAC5B,IAAI,EAAE,iBAAiB;iBACxB;aACF;SACF;QACD;YACE,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE;gBACP,IAAI,EAAE,UAAU;gBAChB,QAAQ,EAAE;oBACR,GAAG,EAAE,gCAAgC,SAAS,EAAE;oBAChD,QAAQ,EAAE,kBAAkB;oBAC5B,IAAI,EAAE,kBAAkB;iBACzB;aACF;SACF;QACD;YACE,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE;gBACP,IAAI,EAAE,UAAU;gBAChB,QAAQ,EAAE;oBACR,GAAG,EAAE,iCAAiC,SAAS,EAAE;oBACjD,QAAQ,EAAE,kBAAkB;oBAC5B,IAAI,EAAE,6BAA6B;iBACpC;aACF;SACF;QACD;YACE,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE;gBACP,IAAI,EAAE,UAAU;gBAChB,QAAQ,EAAE;oBACR,GAAG,EAAE,gCAAgC,SAAS,EAAE;oBAChD,QAAQ,EAAE,kBAAkB;oBAC5B,IAAI,EAAE,kBAAkB;iBACzB;aACF;SACF;QACD;YACE,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE;gBACP,IAAI,EAAE,UAAU;gBAChB,QAAQ,EAAE;oBACR,GAAG,EAAE,6BAA6B,SAAS,EAAE;oBAC7C,QAAQ,EAAE,kBAAkB;oBAC5B,IAAI,EAAE,4BAA4B;iBACnC;aACF;SACF;KACF,CAAC;IAEF,OAAO;QACL,WAAW,EAAE,8CAA8C,SAAS,EAAE;QACtE,QAAQ;KACT,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { GetPromptResult } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
export declare const quarterlyTaxEstimatePrompt: {
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
arguments: {
|
|
6
|
+
name: string;
|
|
7
|
+
description: string;
|
|
8
|
+
required: boolean;
|
|
9
|
+
}[];
|
|
10
|
+
};
|
|
11
|
+
export declare function getQuarterlyTaxEstimateMessages(quarter: string, year: string): GetPromptResult;
|
|
12
|
+
//# sourceMappingURL=quarterly-tax-estimate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quarterly-tax-estimate.d.ts","sourceRoot":"","sources":["../../src/prompts/quarterly-tax-estimate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAiB,MAAM,oCAAoC,CAAC;AAEzF,eAAO,MAAM,0BAA0B;;;;;;;;CAetC,CAAC;AAEF,wBAAgB,+BAA+B,CAC7C,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,GACX,eAAe,CAuHjB"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
export const quarterlyTaxEstimatePrompt = {
|
|
2
|
+
name: 'quarterly_tax_estimate',
|
|
3
|
+
description: 'Estimate tax liability for a specified quarter',
|
|
4
|
+
arguments: [
|
|
5
|
+
{
|
|
6
|
+
name: 'quarter',
|
|
7
|
+
description: 'Quarter number (1-4)',
|
|
8
|
+
required: true,
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
name: 'year',
|
|
12
|
+
description: 'Tax year (YYYY)',
|
|
13
|
+
required: true,
|
|
14
|
+
},
|
|
15
|
+
],
|
|
16
|
+
};
|
|
17
|
+
export function getQuarterlyTaxEstimateMessages(quarter, year) {
|
|
18
|
+
const quarterNum = parseInt(quarter, 10);
|
|
19
|
+
const yearNum = parseInt(year, 10);
|
|
20
|
+
// UK tax quarters typically follow calendar quarters
|
|
21
|
+
const quarterStarts = {
|
|
22
|
+
1: '01-01',
|
|
23
|
+
2: '04-01',
|
|
24
|
+
3: '07-01',
|
|
25
|
+
4: '10-01',
|
|
26
|
+
};
|
|
27
|
+
const quarterEnds = {
|
|
28
|
+
1: '03-31',
|
|
29
|
+
2: '06-30',
|
|
30
|
+
3: '09-30',
|
|
31
|
+
4: '12-31',
|
|
32
|
+
};
|
|
33
|
+
const startDate = `${year}-${quarterStarts[quarterNum]}`;
|
|
34
|
+
const endDate = `${year}-${quarterEnds[quarterNum]}`;
|
|
35
|
+
const messages = [
|
|
36
|
+
{
|
|
37
|
+
role: 'user',
|
|
38
|
+
content: {
|
|
39
|
+
type: 'text',
|
|
40
|
+
text: `Estimate tax liability for Q${quarterNum} ${yearNum} (${startDate} to ${endDate}).
|
|
41
|
+
|
|
42
|
+
Calculate:
|
|
43
|
+
|
|
44
|
+
1. Income Summary:
|
|
45
|
+
- Total invoiced revenue
|
|
46
|
+
- Less: VAT collected (if applicable)
|
|
47
|
+
- Net revenue
|
|
48
|
+
|
|
49
|
+
2. Deductible Expenses:
|
|
50
|
+
- Business expenses by category
|
|
51
|
+
- Bills paid
|
|
52
|
+
- Total allowable deductions
|
|
53
|
+
|
|
54
|
+
3. Profit Estimate:
|
|
55
|
+
- Net profit for quarter
|
|
56
|
+
- Year-to-date comparison
|
|
57
|
+
|
|
58
|
+
4. Tax Estimates (UK rates):
|
|
59
|
+
- Corporation Tax estimate (25% on profits)
|
|
60
|
+
- OR Self-employment tax estimate
|
|
61
|
+
- National Insurance contributions
|
|
62
|
+
- VAT liability (if VAT registered)
|
|
63
|
+
|
|
64
|
+
5. Cash Requirements:
|
|
65
|
+
- Estimated tax due
|
|
66
|
+
- Recommended set-aside amount
|
|
67
|
+
|
|
68
|
+
Note: This is an estimate only. Consult an accountant for accurate tax advice.`,
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
role: 'user',
|
|
73
|
+
content: {
|
|
74
|
+
type: 'resource',
|
|
75
|
+
resource: {
|
|
76
|
+
uri: 'freeagent://company',
|
|
77
|
+
mimeType: 'application/json',
|
|
78
|
+
text: 'Company details (VAT status, company type)',
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
role: 'user',
|
|
84
|
+
content: {
|
|
85
|
+
type: 'resource',
|
|
86
|
+
resource: {
|
|
87
|
+
uri: `freeagent://invoices?from_date=${startDate}&to_date=${endDate}`,
|
|
88
|
+
mimeType: 'application/json',
|
|
89
|
+
text: 'Quarter invoices (revenue)',
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
role: 'user',
|
|
95
|
+
content: {
|
|
96
|
+
type: 'resource',
|
|
97
|
+
resource: {
|
|
98
|
+
uri: `freeagent://expenses?from_date=${startDate}&to_date=${endDate}`,
|
|
99
|
+
mimeType: 'application/json',
|
|
100
|
+
text: 'Quarter expenses',
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
role: 'user',
|
|
106
|
+
content: {
|
|
107
|
+
type: 'resource',
|
|
108
|
+
resource: {
|
|
109
|
+
uri: `freeagent://bills?from_date=${startDate}&to_date=${endDate}`,
|
|
110
|
+
mimeType: 'application/json',
|
|
111
|
+
text: 'Quarter bills',
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
role: 'user',
|
|
117
|
+
content: {
|
|
118
|
+
type: 'resource',
|
|
119
|
+
resource: {
|
|
120
|
+
uri: 'freeagent://categories',
|
|
121
|
+
mimeType: 'application/json',
|
|
122
|
+
text: 'Categories for tax-deductible analysis',
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
];
|
|
127
|
+
return {
|
|
128
|
+
description: `Q${quarterNum} ${yearNum} tax estimate`,
|
|
129
|
+
messages,
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=quarterly-tax-estimate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quarterly-tax-estimate.js","sourceRoot":"","sources":["../../src/prompts/quarterly-tax-estimate.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,IAAI,EAAE,wBAAwB;IAC9B,WAAW,EAAE,gDAAgD;IAC7D,SAAS,EAAE;QACT;YACE,IAAI,EAAE,SAAS;YACf,WAAW,EAAE,sBAAsB;YACnC,QAAQ,EAAE,IAAI;SACf;QACD;YACE,IAAI,EAAE,MAAM;YACZ,WAAW,EAA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ACrE,QAAQ,EAAE,kBAAkB;oBAC5B,IAAI,EAAE,4BAA4B;iBACnC;aACF;SACF;QACD;YACE,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE;gBACP,IAAI,EAAE,UAAU;gBAChB,QAAQ,EAAE;oBACR,GAAG,EAAE,kCAAkC,SAAS,YAAY,OAAO,EAAE;oBACrE,QAAQ,EAAE,kBAAkB;oBAC5B,IAAI,EAAE,kBAAkB;iBACzB;aACF;SACF;QACD;YACE,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE;gBACP,IAAI,EAAE,UAAU;gBAChB,QAAQ,EAAE;oBACR,GAAG,EAAE,+BAA+B,SAAS,YAAY,OAAO,EAAE;oBAClE,QAAQ,EAAE,kBAAkB;oBAC5B,IAAI,EAAE,eAAe;iBACtB;aACF;SACF;QACD;YACE,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE;gBACP,IAAI,EAAE,UAAU;gBAChB,QAAQ,EAAE;oBACR,GAAG,EAAE,wBAAwB;oBAC7B,QAAQ,EAAE,kBAAkB;oBAC5B,IAAI,EAAE,wCAAwC;iBAC/C;aACF;SACF;KACF,CAAC;IAEF,OAAO;QACL,WAAW,EAAE,IAAI,UAAU,IAAI,OAAO,eAAe;QACrD,QAAQ;KACT,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { GetPromptResult } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
export declare const transactionCategorizationPrompt: {
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
arguments: {
|
|
6
|
+
name: string;
|
|
7
|
+
description: string;
|
|
8
|
+
required: boolean;
|
|
9
|
+
}[];
|
|
10
|
+
};
|
|
11
|
+
export declare function getTransactionCategorizationMessages(bankAccountId: string, fromDate?: string): GetPromptResult;
|
|
12
|
+
//# sourceMappingURL=transaction-categorization.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction-categorization.d.ts","sourceRoot":"","sources":["../../src/prompts/transaction-categorization.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAiB,MAAM,oCAAoC,CAAC;AAEzF,eAAO,MAAM,+BAA+B;;;;;;;;CAe3C,CAAC;AAEF,wBAAgB,oCAAoC,CAClD,aAAa,EAAE,MAAM,EACrB,QAAQ,CAAC,EAAE,MAAM,GAChB,eAAe,CAkEjB"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
export const transactionCategorizationPrompt = {
|
|
2
|
+
name: 'transaction_categorization',
|
|
3
|
+
description: 'Suggest categories for unexplained bank transactions',
|
|
4
|
+
arguments: [
|
|
5
|
+
{
|
|
6
|
+
name: 'bank_account_id',
|
|
7
|
+
description: 'Bank account ID to analyze',
|
|
8
|
+
required: true,
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
name: 'from_date',
|
|
12
|
+
description: 'Start date (YYYY-MM-DD)',
|
|
13
|
+
required: false,
|
|
14
|
+
},
|
|
15
|
+
],
|
|
16
|
+
};
|
|
17
|
+
export function getTransactionCategorizationMessages(bankAccountId, fromDate) {
|
|
18
|
+
const today = new Date();
|
|
19
|
+
const defaultFromDate = new Date(today);
|
|
20
|
+
defaultFromDate.setMonth(defaultFromDate.getMonth() - 1);
|
|
21
|
+
const startDate = fromDate ?? defaultFromDate.toISOString().split('T')[0];
|
|
22
|
+
const endDate = today.toISOString().split('T')[0];
|
|
23
|
+
const messages = [
|
|
24
|
+
{
|
|
25
|
+
role: 'user',
|
|
26
|
+
content: {
|
|
27
|
+
type: 'text',
|
|
28
|
+
text: `Review unexplained bank transactions and suggest categories for each.
|
|
29
|
+
|
|
30
|
+
For each transaction:
|
|
31
|
+
1. Analyze the description to identify the type of expense/income
|
|
32
|
+
2. Match against available categories
|
|
33
|
+
3. Suggest the most appropriate category
|
|
34
|
+
4. Flag any that might be:
|
|
35
|
+
- Personal expenses
|
|
36
|
+
- Potential invoice matches
|
|
37
|
+
- Recurring subscriptions
|
|
38
|
+
|
|
39
|
+
After reviewing, I can use the explain_transaction tool to categorize them.`,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
role: 'user',
|
|
44
|
+
content: {
|
|
45
|
+
type: 'resource',
|
|
46
|
+
resource: {
|
|
47
|
+
uri: `freeagent://bank_transactions?bank_account=${bankAccountId}&from_date=${startDate}&to_date=${endDate}&view=unexplained`,
|
|
48
|
+
mimeType: 'application/json',
|
|
49
|
+
text: 'Unexplained transactions to categorize',
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
role: 'user',
|
|
55
|
+
content: {
|
|
56
|
+
type: 'resource',
|
|
57
|
+
resource: {
|
|
58
|
+
uri: 'freeagent://categories',
|
|
59
|
+
mimeType: 'application/json',
|
|
60
|
+
text: 'Available categories for matching',
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
role: 'user',
|
|
66
|
+
content: {
|
|
67
|
+
type: 'resource',
|
|
68
|
+
resource: {
|
|
69
|
+
uri: 'freeagent://invoices?view=recent_open_or_overdue',
|
|
70
|
+
mimeType: 'application/json',
|
|
71
|
+
text: 'Open invoices for potential matching',
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
];
|
|
76
|
+
return {
|
|
77
|
+
description: `Transaction categorization for bank account ${bankAccountId}`,
|
|
78
|
+
messages,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=transaction-categorization.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction-categorization.js","sourceRoot":"","sources":["../../src/prompts/transaction-categorization.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,+BAA+B,GAAG;IAC7C,IAAI,EAAE,4BAA4B;IAClC,WAAW,EAAE,sDAAsD;IACnE,SAAS,EAAE;QACT;YACE,IAAI,EAAE,iBAAiB;Y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,EAAE;gBACP,IAAI,EAAE,UAAU;gBAChB,QAAQ,EAAE;oBACR,GAAG,EAAE,kDAAkD;oBACvD,QAAQ,EAAE,kBAAkB;oBAC5B,IAAI,EAAE,sCAAsC;iBAC7C;aACF;SACF;KACF,CAAC;IAEF,OAAO;QACL,WAAW,EAAE,+CAA+C,aAAa,EAAE;QAC3E,QAAQ;KACT,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { FreeAgentClient } from '../api/freeagent-client.js';
|
|
2
|
+
export interface BankAccountFilters {
|
|
3
|
+
view?: 'all' | 'standard' | 'paypal_accounts' | 'credit_card_accounts';
|
|
4
|
+
}
|
|
5
|
+
export declare function getBankAccounts(client: FreeAgentClient, filters?: BankAccountFilters): Promise<import("../types/llm/index.js").LLMBankAccount[]>;
|
|
6
|
+
export declare function getBankAccount(client: FreeAgentClient, id: string): Promise<import("../types/llm/index.js").LLMBankAccount>;
|
|
7
|
+
export declare function buildBankAccountNameLookup(client: FreeAgentClient): Promise<Map<string, string>>;
|
|
8
|
+
//# sourceMappingURL=bank-accounts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bank-accounts.d.ts","sourceRoot":"","sources":["../../src/resources/bank-accounts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAKlE,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,EAAE,KAAK,GAAG,UAAU,GAAG,iBAAiB,GAAG,sBAAsB,CAAC;CACxE;AAED,wBAAsB,eAAe,CACnC,MAAM,EAAE,eAAe,EACvB,OAAO,GAAE,kBAAuB,6DAejC;AAED,wBAAsB,cAAc,CAAC,MAAM,EAAE,eAAe,EAAE,EAAE,EAAE,MAAM,2DAOvE;AAED,wBAAsB,0BAA0B,CAC9C,MAAM,EAAE,eAAe,GACtB,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAW9B"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { transformBankAccount, transformBankAccounts } from '../transformers/bank-transformer.js';
|
|
2
|
+
import { handleResourceError } from '../utils/error-handler.js';
|
|
3
|
+
export async function getBankAccounts(client, filters = {}) {
|
|
4
|
+
try {
|
|
5
|
+
const params = {};
|
|
6
|
+
if (filters.view)
|
|
7
|
+
params['view'] = filters.view;
|
|
8
|
+
const accounts = await client.fetchAllPages('/bank_accounts', 'bank_accounts', params);
|
|
9
|
+
return transformBankAccounts(accounts);
|
|
10
|
+
}
|
|
11
|
+
catch (error) {
|
|
12
|
+
handleResourceError(error, 'freeagent://bank_accounts');
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export async function getBankAccount(client, id) {
|
|
16
|
+
try {
|
|
17
|
+
const response = await client.get(`/bank_accounts/${id}`);
|
|
18
|
+
return transformBankAccount(response.bank_account);
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
handleResourceError(error, `freeagent://bank_accounts/${id}`);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export async function buildBankAccountNameLookup(client) {
|
|
25
|
+
const accounts = await getBankAccounts(client, { view: 'all' });
|
|
26
|
+
const lookup = new Map();
|
|
27
|
+
for (const account of accounts) {
|
|
28
|
+
lookup.set(`https://api.freeagent.com/v2/bank_accounts/${account.id}`, account.name);
|
|
29
|
+
lookup.set(`https://api.sandbox.freeagent.com/v2/bank_accounts/${account.id}`, account.name);
|
|
30
|
+
lookup.set(account.id, account.name);
|
|
31
|
+
}
|
|
32
|
+
return lookup;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=bank-accounts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bank-accounts.js","sourceRoot":"","sources":["../../src/resources/bank-accounts.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAClG,OAAO,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,CAAC,GAAG,CAAC,sDAAsD,OAAO,CAAC,EAAE,EAAE,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;QAC7F,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { FreeAgentClient } from '../api/freeagent-client.js';
|
|
2
|
+
export interface BankTransactionFilters {
|
|
3
|
+
bankAccount: string;
|
|
4
|
+
fromDate?: string;
|
|
5
|
+
toDate?: string;
|
|
6
|
+
updatedSince?: string;
|
|
7
|
+
view?: 'unexplained' | 'all';
|
|
8
|
+
}
|
|
9
|
+
export declare function getBankTransactions(client: FreeAgentClient, filters: BankTransactionFilters, bankAccountNameLookup?: Map<string, string>): Promise<import("../types/llm/index.js").LLMBankTransaction[]>;
|
|
10
|
+
export declare function getBankTransaction(client: FreeAgentClient, id: string, bankAccountNameLookup?: Map<string, string>): Promise<import("../types/llm/index.js").LLMBankTransaction>;
|
|
11
|
+
//# sourceMappingURL=bank-transactions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bank-transactions.d.ts","sourceRoot":"","sources":["../../src/resources/bank-transactions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAOlE,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,aAAa,GAAG,KAAK,CAAC;CAC9B;AAED,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,eAAe,EACvB,OAAO,EAAE,sBAAsB,EAC/B,qBAAqB,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,iEAoB5C;AAED,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,eAAe,EACvB,EAAE,EAAE,MAAM,EACV,qBAAqB,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,+DAU5C"}
|