Skip to main content
Glama
b-open-io

Bitcoin SV MCP Server

by b-open-io

bsv_getPrice

Fetch the current Bitcoin SV (BSV) price in USD to calculate transaction values, monitor market conditions, or convert between BSV and fiat currencies using real-time data from a reliable exchange API.

Instructions

Retrieves the current price of Bitcoin SV (BSV) in USD from a reliable exchange API. This tool provides real-time market data that can be used for calculating transaction values, monitoring market conditions, or converting between BSV and fiat currencies.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
argsNoNo parameters required - simply returns the current BSV price in USD

Implementation Reference

  • The handler function for the 'bsv_getPrice' tool. It calls getBsvPriceWithCache to fetch the price, formats it, and returns it as text content, handling errors appropriately.
    	async () => {
    		try {
    			const price = await getBsvPriceWithCache();
    			return {
    				content: [
    					{
    						type: "text",
    						text: `Current BSV price: $${price.toFixed(2)} USD`,
    					},
    				],
    			};
    		} catch (err) {
    			return {
    				content: [{ type: "text", text: "Error fetching BSV price." }],
    				isError: true,
    			};
    		}
    	},
    );
  • Zod schema for tool input arguments. Defines an optional empty object, indicating no parameters are required.
    args: z
    	.object({})
    	.optional()
    	.describe(
    		"No parameters required - simply returns the current BSV price in USD",
    	),
  • The registration function 'registerGetPriceTool' that registers the 'bsv_getPrice' tool on the MCP server, including name, description, schema, and handler.
    export function registerGetPriceTool(server: McpServer): void {
    	server.tool(
    		"bsv_getPrice",
    		"Retrieves the current price of Bitcoin SV (BSV) in USD from a reliable exchange API. This tool provides real-time market data that can be used for calculating transaction values, monitoring market conditions, or converting between BSV and fiat currencies.",
    		{
    			args: z
    				.object({})
    				.optional()
    				.describe(
    					"No parameters required - simply returns the current BSV price in USD",
    				),
    		},
    		async () => {
    			try {
    				const price = await getBsvPriceWithCache();
    				return {
    					content: [
    						{
    							type: "text",
    							text: `Current BSV price: $${price.toFixed(2)} USD`,
    						},
    					],
    				};
    			} catch (err) {
    				return {
    					content: [{ type: "text", text: "Error fetching BSV price." }],
    					isError: true,
    				};
    			}
    		},
    	);
    }
  • Helper function that fetches the BSV price from Whatsonchain API with a 5-minute caching mechanism to avoid excessive API calls.
    async function getBsvPriceWithCache(): Promise<number> {
    	// Return cached price if it's still valid
    	if (
    		cachedPrice &&
    		Date.now() - cachedPrice.timestamp < PRICE_CACHE_DURATION
    	) {
    		return cachedPrice.value;
    	}
    
    	// If no valid cache, fetch new price
    	const res = await fetch(
    		"https://api.whatsonchain.com/v1/bsv/main/exchangerate",
    	);
    	if (!res.ok) throw new Error("Failed to fetch price");
    
    	const data = (await res.json()) as {
    		currency: string;
    		rate: string;
    		time: number;
    	};
    
    	const price = Number(data.rate);
    	if (Number.isNaN(price) || price <= 0)
    		throw new Error("Invalid price received");
    
    	// Update cache
    	cachedPrice = {
    		value: price,
    		timestamp: Date.now(),
    	};
    
    	return price;
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden. It discloses the tool fetches 'real-time market data' and mentions the source ('reliable exchange API'), which adds useful context. However, it doesn't mention potential limitations like rate limits, authentication requirements, error conditions, or data freshness guarantees that would be important for a price API tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is efficiently structured with two sentences: the first states the core functionality, and the second provides usage context. Every sentence adds value without redundancy, and it's appropriately front-loaded with the primary purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple price retrieval tool with no annotations and no output schema, the description provides adequate purpose and usage context. However, it lacks details about the return format (e.g., numeric value, timestamp, currency pair), error handling, or data source specifics that would be helpful given the absence of structured output documentation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100% and clearly states 'No parameters required - simply returns the current BSV price in USD'. The description reinforces this by not mentioning any parameters, which is appropriate for a zero-parameter tool. The baseline for 0 parameters is 4.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Retrieves'), resource ('current price of Bitcoin SV (BSV) in USD'), and data source ('from a reliable exchange API'). It distinguishes itself from siblings by focusing on real-time price data rather than transaction decoding, exploration, or ordinal-related functions.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context for when to use this tool ('calculating transaction values, monitoring market conditions, or converting between BSV and fiat currencies'). However, it doesn't explicitly state when not to use it or name specific alternatives among the sibling tools for similar price data needs.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/b-open-io/bsv-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server