Skip to main content
Glama

get_sol_price

Retrieve the current SOL/USD exchange rate to monitor Solana token values for trading decisions or wallet management.

Instructions

Get the current SOL/USD price.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function that executes the get_sol_price tool logic by calling the getSolPrice helper.
    export async function handleGetSolPrice(): Promise<string> {
      try {
        const price = await getSolPrice();
        return JSON.stringify({
          success: true,
          solPriceUsd: price,
        });
      } catch (error) {
        return JSON.stringify({
          success: false,
          error: error instanceof Error ? error.message : String(error),
        });
      }
    }
  • Helper function that performs the API request to fetch the SOL/USD price.
    export async function getSolPrice(): Promise<number> {
      const data = await apiGet('/api/solana-price');
      return (data.solanaPrice as number) || 0;
    }
  • Schema definition for the get_sol_price tool.
    export const getSolPriceSchema = z.object({});

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/RefundYourSOL/refundyoursol-mcp'

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