Commitdfa7598cRecorded29 Mar 2026Repositorytally

Fix MCP server startup and tool registration

Message

Convert mcp-server-register-tool! calls from keyword to positional args matching the 5-arg signature. Replace (exit 1) with (error ...) in import-qbo error path since exit is not reliably available in all module contexts.

Changed
 src/tally/main.sgl  |  5 +----
 src/tally/tools.sgl | 98 +++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------
 2 files changed, 50 insertions(+), 53 deletions(-)
Diff
src/tally/main.sglmodified
@@ -75,10 +75,7 @@
75
(define (cli-import-qbo config opts args)
76
(let* ((csv-path (if (pair? args)
77
(car args)
78
(begin
79
(display "Error: CSV file path required.\n")
80
(display "Usage: tally import-qbo <csv-file> [--output FILE] [--account-map FILE]\n")
81
(exit 1))))
+78
(error "CSV file path required. Usage: tally import-qbo <csv-file> [--output FILE] [--account-map FILE]")))
79
(output-path (alist-get 'output opts))
80
(map-path (alist-get 'account-map opts))
81
(account-map (if map-path
src/tally/tools.sglmodified
@@ -174,62 +174,62 @@
174
(until-default (default-until-date)))
175
176
(mcp-server-register-tool! server
177
name: "tally/pull"
178
description: "Pull recent transactions from Wise API. Returns a summary of transactions found."
179
schema: #{ type: "object"
180
properties: #{
181
since: #{ type: "string"
182
description: "Start date in ISO 8601 format" }
183
until: #{ type: "string"
184
description: "End date in ISO 8601 format" }
185
profile: #{ type: "string"
186
description: "Wise profile type: personal or business" } } }
187
handler: (lambda (params) (tool-pull config params since-default until-default)))
+177
"tally/pull"
+178
"Pull recent transactions from Wise API. Returns a summary of transactions found."
+179
#{ type: "object"
+180
properties: #{
+181
since: #{ type: "string"
+182
description: "Start date in ISO 8601 format" }
+183
until: #{ type: "string"
+184
description: "End date in ISO 8601 format" }
+185
profile: #{ type: "string"
+186
description: "Wise profile type: personal or business" } } }
+187
(lambda (params) (tool-pull config params since-default until-default)))
188
189
(mcp-server-register-tool! server
190
name: "tally/import"
191
description: "Pull transactions from Wise and import new ones into the hledger journal file. Deduplicates automatically."
192
schema: #{ type: "object"
193
properties: #{
194
journal: #{ type: "string"
195
description: "Path to journal file (default: from TALLY_JOURNAL env)" }
196
since: #{ type: "string"
197
description: "Start date in ISO 8601 format" }
198
until: #{ type: "string"
199
description: "End date in ISO 8601 format" }
200
profile: #{ type: "string"
201
description: "Wise profile type: personal or business" } } }
202
handler: (lambda (params) (tool-import config params since-default until-default)))
+190
"tally/import"
+191
"Pull transactions from Wise and import new ones into the hledger journal file. Deduplicates automatically."
+192
#{ type: "object"
+193
properties: #{
+194
journal: #{ type: "string"
+195
description: "Path to journal file (default: from TALLY_JOURNAL env)" }
+196
since: #{ type: "string"
+197
description: "Start date in ISO 8601 format" }
+198
until: #{ type: "string"
+199
description: "End date in ISO 8601 format" }
+200
profile: #{ type: "string"
+201
description: "Wise profile type: personal or business" } } }
+202
(lambda (params) (tool-import config params since-default until-default)))
203
204
(mcp-server-register-tool! server
205
name: "tally/balance"
206
description: "Show current Wise account balances across all currencies."
207
schema: #{ type: "object"
208
properties: #{
209
profile: #{ type: "string"
210
description: "Wise profile type: personal or business" } } }
211
handler: (lambda (params) (tool-balance config params)))
+205
"tally/balance"
+206
"Show current Wise account balances across all currencies."
+207
#{ type: "object"
+208
properties: #{
+209
profile: #{ type: "string"
+210
description: "Wise profile type: personal or business" } } }
+211
(lambda (params) (tool-balance config params)))
212
213
(mcp-server-register-tool! server
214
name: "tally/report"
215
description: "Run an hledger report on the journal file. Supports balance (bal), register (reg), and income statement (is)."
216
schema: #{ type: "object"
217
properties: #{
218
journal: #{ type: "string"
219
description: "Path to journal file" }
220
type: #{ type: "string"
221
description: "Report type: bal, reg, or is (default: bal)" }
222
query: #{ type: "string"
223
description: "Optional hledger query (e.g. 'assets', 'expenses:food')" } } }
224
handler: (lambda (params) (tool-report config params)))
+214
"tally/report"
+215
"Run an hledger report on the journal file. Supports balance (bal), register (reg), and income statement (is)."
+216
#{ type: "object"
+217
properties: #{
+218
journal: #{ type: "string"
+219
description: "Path to journal file" }
+220
type: #{ type: "string"
+221
description: "Report type: bal, reg, or is (default: bal)" }
+222
query: #{ type: "string"
+223
description: "Optional hledger query (e.g. 'assets', 'expenses:food')" } } }
+224
(lambda (params) (tool-report config params)))
225
226
(mcp-server-register-tool! server
227
name: "tally/categorize"
228
description: "List uncategorized transactions in the journal. Use this to find transactions that need category assignment."
229
schema: #{ type: "object"
230
properties: #{
231
journal: #{ type: "string"
232
description: "Path to journal file" } } }
233
handler: (lambda (params) (tool-categorize config params)))))
+227
"tally/categorize"
+228
"List uncategorized transactions in the journal. Use this to find transactions that need category assignment."
+229
#{ type: "object"
+230
properties: #{
+231
journal: #{ type: "string"
+232
description: "Path to journal file" } } }
+233
(lambda (params) (tool-categorize config params)))))
234
235
))