@rustledger/mcp-server 0.2.0 → 0.5.2

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.
@@ -0,0 +1,41 @@
1
+ # BQL Functions Reference
2
+
3
+ ## Aggregate Functions
4
+ | Function | Description |
5
+ |----------|-------------|
6
+ | `sum(x)` | Sum of values |
7
+ | `count()` | Count of rows |
8
+ | `first(x)` | First value |
9
+ | `last(x)` | Last value |
10
+ | `min(x)` | Minimum value |
11
+ | `max(x)` | Maximum value |
12
+
13
+ ## Date Functions
14
+ | Function | Description |
15
+ |----------|-------------|
16
+ | `year(date)` | Extract year (integer) |
17
+ | `month(date)` | Extract month (1-12) |
18
+ | `day(date)` | Extract day of month |
19
+ | `quarter(date)` | Extract quarter (1-4) |
20
+ | `weekday(date)` | Day of week (0=Monday) |
21
+
22
+ ## String Functions
23
+ | Function | Description |
24
+ |----------|-------------|
25
+ | `length(s)` | String length |
26
+ | `upper(s)` | Uppercase string |
27
+ | `lower(s)` | Lowercase string |
28
+
29
+ ## Account Functions
30
+ | Function | Description |
31
+ |----------|-------------|
32
+ | `root(account, n)` | First n components |
33
+ | `leaf(account)` | Last component |
34
+ | `parent(account)` | Parent account |
35
+
36
+ ## Conversion Functions
37
+ | Function | Description |
38
+ |----------|-------------|
39
+ | `cost(position)` | Convert to cost basis |
40
+ | `value(position)` | Market value (needs prices) |
41
+ | `units(position)` | Just the units |
@@ -0,0 +1,26 @@
1
+ # BQL Tables
2
+
3
+ BQL queries run against these implicit tables:
4
+
5
+ ## entries (default)
6
+ The main table containing all postings from transactions.
7
+
8
+ | Column | Type | Description |
9
+ |--------|------|-------------|
10
+ | date | date | Transaction date |
11
+ | flag | string | Transaction flag (* or !) |
12
+ | payee | string | Transaction payee |
13
+ | narration | string | Transaction narration |
14
+ | account | string | Posting account |
15
+ | position | position | Posting amount with cost |
16
+ | balance | inventory | Running balance |
17
+ | tags | set | Transaction tags |
18
+ | links | set | Transaction links |
19
+
20
+ ## balances
21
+ Pre-aggregated account balances.
22
+
23
+ | Column | Type | Description |
24
+ |--------|------|-------------|
25
+ | account | string | Account name |
26
+ | balance | inventory | Total balance |
@@ -0,0 +1,62 @@
1
+ # BQL - Beancount Query Language
2
+
3
+ BQL is a SQL-like query language for querying Beancount ledgers.
4
+
5
+ ## Basic Syntax
6
+
7
+ ```sql
8
+ SELECT [DISTINCT] <target-spec>, ...
9
+ [FROM <from-spec>]
10
+ [WHERE <where-expression>]
11
+ [GROUP BY <group-spec>, ...]
12
+ [ORDER BY <order-spec>, ...]
13
+ [LIMIT <limit>]
14
+ ```
15
+
16
+ ## Common Queries
17
+
18
+ ### Account Balances
19
+ ```sql
20
+ BALANCES
21
+ -- or equivalently:
22
+ SELECT account, sum(position) GROUP BY account
23
+ ```
24
+
25
+ ### Filter by Account
26
+ ```sql
27
+ SELECT date, narration, position
28
+ WHERE account ~ "Expenses:Food"
29
+ ```
30
+
31
+ ### Filter by Date Range
32
+ ```sql
33
+ SELECT date, account, position
34
+ WHERE date >= 2024-01-01 AND date < 2024-02-01
35
+ ```
36
+
37
+ ### Monthly Summary
38
+ ```sql
39
+ SELECT year(date), month(date), sum(position)
40
+ WHERE account ~ "Expenses"
41
+ GROUP BY year(date), month(date)
42
+ ORDER BY year(date), month(date)
43
+ ```
44
+
45
+ ### Journal Entries
46
+ ```sql
47
+ JOURNAL "Assets:Checking"
48
+ ```
49
+
50
+ ## Available Functions
51
+
52
+ - `year(date)`, `month(date)`, `day(date)` - Extract date parts
53
+ - `sum(position)` - Sum positions
54
+ - `count()` - Count entries
55
+ - `first(x)`, `last(x)` - First/last values
56
+ - `min(x)`, `max(x)` - Min/max values
57
+
58
+ ## Operators
59
+
60
+ - `~` - Regex match (e.g., `account ~ "Expenses:.*"`)
61
+ - `=`, `!=`, `<`, `>`, `<=`, `>=` - Comparisons
62
+ - `AND`, `OR`, `NOT` - Boolean operators
@@ -0,0 +1,67 @@
1
+ # Beancount Directives Reference
2
+
3
+ ## Transaction
4
+ ```beancount
5
+ 2024-01-15 * "Payee" "Narration"
6
+ Assets:Checking -50.00 USD
7
+ Expenses:Food 50.00 USD
8
+ ```
9
+
10
+ ## Open Account
11
+ ```beancount
12
+ 2024-01-01 open Assets:Checking USD,EUR
13
+ ```
14
+
15
+ ## Close Account
16
+ ```beancount
17
+ 2024-12-31 close Assets:OldAccount
18
+ ```
19
+
20
+ ## Balance Assertion
21
+ ```beancount
22
+ 2024-01-31 balance Assets:Checking 1000.00 USD
23
+ ```
24
+
25
+ ## Pad
26
+ ```beancount
27
+ 2024-01-01 pad Assets:Checking Equity:Opening-Balances
28
+ ```
29
+
30
+ ## Commodity
31
+ ```beancount
32
+ 2024-01-01 commodity USD
33
+ name: "US Dollar"
34
+ ```
35
+
36
+ ## Price
37
+ ```beancount
38
+ 2024-01-15 price AAPL 185.50 USD
39
+ ```
40
+
41
+ ## Event
42
+ ```beancount
43
+ 2024-01-01 event "location" "New York"
44
+ ```
45
+
46
+ ## Note
47
+ ```beancount
48
+ 2024-01-15 note Assets:Checking "Called bank about fees"
49
+ ```
50
+
51
+ ## Document
52
+ ```beancount
53
+ 2024-01-15 document Assets:Checking "/path/to/statement.pdf"
54
+ ```
55
+
56
+ ## Query
57
+ ```beancount
58
+ 2024-01-01 query "monthly-expenses" "
59
+ SELECT month, sum(position) WHERE account ~ 'Expenses'
60
+ GROUP BY month
61
+ "
62
+ ```
63
+
64
+ ## Custom
65
+ ```beancount
66
+ 2024-01-01 custom "budget" "Expenses:Food" 500 USD
67
+ ```
@@ -0,0 +1,40 @@
1
+ # Validation Errors Reference
2
+
3
+ rustledger validates ledgers and reports these error types:
4
+
5
+ ## Account Errors
6
+ - **E0001**: Account not opened before use
7
+ - **E0002**: Account already opened
8
+ - **E0003**: Account closed but still has transactions
9
+ - **E0004**: Invalid account name format
10
+
11
+ ## Balance Errors
12
+ - **E0101**: Balance assertion failed
13
+ - **E0102**: Negative balance not allowed
14
+
15
+ ## Transaction Errors
16
+ - **E0201**: Transaction does not balance
17
+ - **E0202**: Missing posting amount (only one allowed)
18
+ - **E0203**: Currency mismatch in transaction
19
+
20
+ ## Booking Errors
21
+ - **E0301**: Ambiguous lot matching
22
+ - **E0302**: Insufficient lots for reduction
23
+ - **E0303**: Cost basis mismatch
24
+
25
+ ## Date Errors
26
+ - **E0401**: Future date not allowed
27
+ - **E0402**: Date out of order
28
+
29
+ ## Document/Note Errors
30
+ - **E0501**: Document file not found
31
+ - **E0502**: Invalid document path
32
+
33
+ ## Plugin Errors
34
+ - **E0601**: Plugin not found
35
+ - **E0602**: Plugin execution error
36
+
37
+ ## Parse Errors
38
+ - **E0701**: Syntax error
39
+ - **E0702**: Invalid directive format
40
+ - **E0703**: Duplicate option
@@ -0,0 +1,6 @@
1
+ import type { ToolResponse, ToolArguments } from "./types.js";
2
+ /**
3
+ * Handle a tool call and return the response.
4
+ */
5
+ export declare function handleToolCall(name: string, args: ToolArguments | undefined): ToolResponse;
6
+ //# sourceMappingURL=handlers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../src/handlers.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAGV,YAAY,EACZ,aAAa,EACd,MAAM,YAAY,CAAC;AAWpB;;GAEG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,aAAa,GAAG,SAAS,GAC9B,YAAY,CAmEd"}