Skip to main content
Glama
b-open-io

Bitcoin SV MCP Server

by b-open-io

ordinals_getTokenByIdOrTicker

Fetch detailed BSV-20 token data by ID or ticker symbol using this Bitcoin SV tool. Verify authenticity, check supply metrics, and access token status for accurate blockchain insights.

Instructions

Retrieves detailed information about a specific BSV-20 token by its ID or ticker symbol. Returns complete token data including ticker symbol, supply information, decimals, and current status. This tool is useful for verifying token authenticity or checking supply metrics.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
argsYes

Implementation Reference

  • The handler function that validates input, constructs API endpoint, fetches BSV-20 token data from GorillaPool API, and returns formatted JSON response or error.
    	async (
    		{ args }: { args: GetTokenByIdOrTickerArgs },
    		extra: RequestHandlerExtra,
    	) => {
    		try {
    			const { id, tick } = args;
    
    			// Validate that at least one of id or tick is provided
    			if (!id && !tick) {
    				throw new Error("Either token ID or ticker symbol must be provided");
    			}
    
    			// Validate ID format if provided
    			if (id && !/^[0-9a-f]{64}_\d+$/i.test(id)) {
    				throw new Error("Invalid BSV20 ID format. Expected 'txid_vout'");
    			}
    
    			// Determine which endpoint to use based on provided parameters
    			let endpoint: string;
    			if (id) {
    				endpoint = `https://ordinals.gorillapool.io/api/bsv20/id/${id}`;
    			} else {
    				endpoint = `https://ordinals.gorillapool.io/api/bsv20/tick/${tick}`;
    			}
    
    			// Fetch BSV20 token data from GorillaPool API
    			const response = await fetch(endpoint);
    
    			if (response.status === 404) {
    				return {
    					content: [
    						{
    							type: "text",
    							text: JSON.stringify({ error: "BSV20 token not found" }),
    						},
    					],
    				};
    			}
    
    			if (!response.ok) {
    				throw new Error(
    					`API error: ${response.status} ${response.statusText}`,
    				);
    			}
    
    			const data = (await response.json()) as TokenResponse;
    
    			return {
    				content: [
    					{
    						type: "text",
    						text: JSON.stringify(data, null, 2),
    					},
    				],
    			};
    		} catch (error) {
    			return {
    				content: [
    					{
    						type: "text",
    						text: error instanceof Error ? error.message : String(error),
    					},
    				],
    				isError: true,
    			};
    		}
    	},
    );
  • Zod schema defining input arguments: optional id (txid_vout) or tick, requiring at least one.
    export const getTokenByIdOrTickerArgsSchema = z
    	.object({
    		id: z
    			.string()
    			.optional()
    			.describe("BSV20 token ID in outpoint format (txid_vout)"),
    		tick: z.string().optional().describe("BSV20 token ticker symbol"),
    	})
    	.refine((data) => data.id || data.tick, {
    		message: "Either id or tick must be provided",
    	});
  • Function that registers the 'ordinals_getTokenByIdOrTicker' tool with the MCP server, including name, description, schema, and handler.
    export function registerGetTokenByIdOrTickerTool(server: McpServer): void {
    	server.tool(
    		"ordinals_getTokenByIdOrTicker",
    		"Retrieves detailed information about a specific BSV-20 token by its ID or ticker symbol. Returns complete token data including ticker symbol, supply information, decimals, and current status. This tool is useful for verifying token authenticity or checking supply metrics.",
    		{
    			args: getTokenByIdOrTickerArgsSchema,
    		},
    		async (
    			{ args }: { args: GetTokenByIdOrTickerArgs },
    			extra: RequestHandlerExtra,
    		) => {
    			try {
    				const { id, tick } = args;
    
    				// Validate that at least one of id or tick is provided
    				if (!id && !tick) {
    					throw new Error("Either token ID or ticker symbol must be provided");
    				}
    
    				// Validate ID format if provided
    				if (id && !/^[0-9a-f]{64}_\d+$/i.test(id)) {
    					throw new Error("Invalid BSV20 ID format. Expected 'txid_vout'");
    				}
    
    				// Determine which endpoint to use based on provided parameters
    				let endpoint: string;
    				if (id) {
    					endpoint = `https://ordinals.gorillapool.io/api/bsv20/id/${id}`;
    				} else {
    					endpoint = `https://ordinals.gorillapool.io/api/bsv20/tick/${tick}`;
    				}
    
    				// Fetch BSV20 token data from GorillaPool API
    				const response = await fetch(endpoint);
    
    				if (response.status === 404) {
    					return {
    						content: [
    							{
    								type: "text",
    								text: JSON.stringify({ error: "BSV20 token not found" }),
    							},
    						],
    					};
    				}
    
    				if (!response.ok) {
    					throw new Error(
    						`API error: ${response.status} ${response.statusText}`,
    					);
    				}
    
    				const data = (await response.json()) as TokenResponse;
    
    				return {
    					content: [
    						{
    							type: "text",
    							text: JSON.stringify(data, null, 2),
    						},
    					],
    				};
    			} catch (error) {
    				return {
    					content: [
    						{
    							type: "text",
    							text: error instanceof Error ? error.message : String(error),
    						},
    					],
    					isError: true,
    				};
    			}
    		},
    	);
    }
  • Invocation of the register function within the registerOrdinalsTools aggregator.
    registerGetTokenByIdOrTickerTool(server);
  • Type interface for the BSV20 token response from the API.
    interface TokenResponse {
    	id: string;
    	tick?: string;
    	sym?: string;
    	max?: string;
    	lim?: string;
    	dec?: number;
    	supply?: string;
    	amt?: string;
    	status?: number;
    	icon?: string;
    	height?: number;
    	[key: string]: unknown;
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions the tool retrieves detailed information and returns complete token data, which implies a read-only operation, but doesn't explicitly state whether it's safe, requires authentication, has rate limits, or what happens on errors. For a tool with zero annotation coverage, this leaves significant gaps in understanding its behavior and constraints.

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

Conciseness4/5

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

The description is appropriately sized with two sentences: the first states the purpose and parameters, and the second provides usage context. It's front-loaded with the core functionality, and every sentence adds value without redundancy. However, it could be slightly more structured by explicitly listing return fields or constraints.

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?

Given the complexity (1 parameter with nested objects, no output schema, no annotations), the description is moderately complete. It covers the purpose, parameters, and usage context but lacks details on return values, error handling, or behavioral traits. Without an output schema, it should ideally explain what 'complete token data' includes, but it doesn't. It's adequate for basic use but has clear gaps for full agent understanding.

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

Parameters3/5

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

The description adds meaning by specifying that the tool retrieves information 'by its ID or ticker symbol,' which aligns with the two properties in the input schema (id and tick). However, with 0% schema description coverage, the schema provides no descriptions for these parameters. The description compensates somewhat by indicating what the parameters represent, but it doesn't detail formats (e.g., ID as outpoint) or usage rules (e.g., exclusive OR). Baseline is 3 as it adds some value but doesn't fully compensate for the coverage gap.

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

Purpose4/5

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

The description clearly states the tool's purpose: retrieving detailed information about a specific BSV-20 token by ID or ticker symbol. It specifies the resource (BSV-20 token) and action (retrieving detailed information), and distinguishes it from siblings like ordinals_getInscription or ordinals_marketListings by focusing on token data rather than inscriptions or market listings. However, it doesn't explicitly differentiate from all siblings (e.g., bsv_explore might also retrieve data).

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

Usage Guidelines3/5

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

The description implies usage context by stating it's 'useful for verifying token authenticity or checking supply metrics,' which suggests when to use it. However, it doesn't provide explicit guidance on when to use this tool versus alternatives like bsv_explore or ordinals_searchInscriptions, nor does it specify prerequisites or exclusions. The guidance is present but not comprehensive.

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