Merge branch 'main' into claude/sure-patrimonial-history-c8s7am

Signed-off-by: Juan José Mata <juanjo.mata@gmail.com>
This commit is contained in:
Juan José Mata
2026-08-01 11:59:42 -07:00
committed by GitHub
7 changed files with 358 additions and 3 deletions

View File

@@ -238,6 +238,7 @@ class McpControllerTest < ActionDispatch::IntegrationTest
assert_includes tool_names, "get_holdings"
assert_includes tool_names, "get_balance_sheet"
assert_includes tool_names, "get_income_statement"
assert_includes tool_names, "update_transaction"
# Each tool has required fields
tools.each do |tool|
@@ -385,6 +386,30 @@ class McpControllerTest < ActionDispatch::IntegrationTest
assert_not inner["duplicate"]
assert_equal Digest::SHA256.hexdigest(content), inner.dig("statement", "content_sha256")
end
test "tools/call executes update_transaction" do
with_mcp_env do
transaction = transactions(:one)
category = categories(:subcategory)
post "/mcp", params: jsonrpc_request("tools/call", {
name: "update_transaction",
arguments: {
id: transaction.id,
category_id: category.id,
notes: "Updated through MCP"
}
}).to_json, headers: mcp_headers(@token)
assert_response :ok
body = JSON.parse(response.body)
result = body["result"]
inner = JSON.parse(result["content"][0]["text"])
assert_equal true, inner["success"]
assert_equal category.id, transaction.reload.category_id
assert_equal "Updated through MCP", transaction.entry.notes
end
end
test "tools/call wraps function errors as isError response" do