cotiv2-mcp
Version:
> A plug-and-play MCP tool server to **send COTI**, **transfer BEP-20 tokens**, **deploy tokens**, and **interact with smart contracts** on the **COTI v2 Network (COTI)** — built for **Claude Desktop**, **AI agents**, and **developers.**
37 lines (36 loc) • 1.31 kB
JavaScript
import { z } from "zod";
import { getBalance } from "../functions/fetchBalanceTool.js";
import { getAccount } from "../config.js";
export function registerGetWalletInfo(server) {
server.tool("Get_Wallet_Info", "👛View detailed balance and holdings for any wallet address", {
address: z
.string()
.optional()
.describe("When querying the user's own wallet value, it is null"),
}, async ({ address }) => {
try {
if (address === "" || !address || address === "null") {
const account = await getAccount();
address = account.address;
}
const balance = await getBalance(address);
return {
content: [
{
type: "text",
text: `Native Balance (COTI): ${balance}\n\nWallet Address: ${address}`,
},
],
};
}
catch (error) {
const errorMessage = error instanceof Error ? error.message : String(error);
return {
content: [
{ type: "text", text: `Failed to fetch balance: ${errorMessage}` },
],
isError: true,
};
}
});
}