@covalenthq/goldrush-mcp-server
Version:
GoldRush MCP Server for interacting with Covalent GoldRush API
102 lines • 3.75 kB
JavaScript
import { validQuoteValues } from "../utils/constants.js";
import { TOOL_DESCRIPTIONS, PARAM_DESCRIPTIONS, } from "../utils/generated-descriptions.js";
import { stringifyWithBigInt } from "../utils/helpers.js";
import { z } from "zod";
export function addBitcoinServiceTools(server, goldRushClient) {
server.tool("bitcoin_hd_wallet_balances", TOOL_DESCRIPTIONS["bitcoin_hd_wallet_balances"], {
walletAddress: z
.string()
.describe(PARAM_DESCRIPTIONS["bitcoin_hd_wallet_balances"]["walletAddress"]),
quoteCurrency: z
.enum(Object.values(validQuoteValues))
.optional()
.describe(PARAM_DESCRIPTIONS["bitcoin_hd_wallet_balances"]["quoteCurrency"]),
}, async (params) => {
try {
const response = await goldRushClient.BitcoinService.getBitcoinHdWalletBalances(params.walletAddress, {
quoteCurrency: params.quoteCurrency,
});
return {
content: [
{
type: "text",
text: stringifyWithBigInt(response.data),
},
],
};
}
catch (error) {
return {
content: [{ type: "text", text: `Error: ${error}` }],
isError: true,
};
}
});
server.tool("bitcoin_transactions", TOOL_DESCRIPTIONS["bitcoin_transactions"], {
address: z
.string()
.describe(PARAM_DESCRIPTIONS["bitcoin_transactions"]["address"]),
pageSize: z
.number()
.optional()
.default(10)
.describe(PARAM_DESCRIPTIONS["bitcoin_transactions"]["pageSize"]),
pageNumber: z
.number()
.optional()
.default(0)
.describe(PARAM_DESCRIPTIONS["bitcoin_transactions"]["pageNumber"]),
}, async (params) => {
try {
const response = await goldRushClient.BitcoinService.getTransactionsForBtcAddress({
address: params.address,
pageSize: params.pageSize,
pageNumber: params.pageNumber,
});
return {
content: [
{
type: "text",
text: stringifyWithBigInt(response.data),
},
],
};
}
catch (error) {
return {
content: [{ type: "text", text: `Error: ${error}` }],
isError: true,
};
}
});
server.tool("bitcoin_non_hd_wallet_balances", TOOL_DESCRIPTIONS["bitcoin_non_hd_wallet_balances"], {
walletAddress: z
.string()
.describe(PARAM_DESCRIPTIONS["bitcoin_non_hd_wallet_balances"]["walletAddress"]),
quoteCurrency: z
.enum(Object.values(validQuoteValues))
.optional()
.describe(PARAM_DESCRIPTIONS["bitcoin_non_hd_wallet_balances"]["quoteCurrency"]),
}, async (params) => {
try {
const response = await goldRushClient.BitcoinService.getBitcoinNonHdWalletBalances(params.walletAddress, {
quoteCurrency: params.quoteCurrency,
});
return {
content: [
{
type: "text",
text: stringifyWithBigInt(response.data),
},
],
};
}
catch (error) {
return {
content: [{ type: "text", text: `Error: ${error}` }],
isError: true,
};
}
});
}
//# sourceMappingURL=BitcoinService.js.map