Skip to main content
Glama
sergeyklay

poe2-mcp-server

by sergeyklay

poe2_currency_check

Check current Path of Exile 2 currency values in chaos orbs and trade volume by searching partial currency names across different leagues.

Instructions

Look up the current value of a specific currency in Path of Exile 2.

Searches by partial name match (case-insensitive) against currency ids and reference item names.

Args:

  • name (string): Currency name or partial name, e.g. "exalted", "divine", "regal"

  • league (string): League name (default: "Fate of the Vaal")

Returns: Matched currency with its chaos-equivalent value and trade volume.

Examples:

  • "How much is a Divine Orb?" → name="divine"

  • "Price of Regal Orb" → name="regal"

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesCurrency name or partial match
leagueNoPoE2 league name, e.g. "Fate of the Vaal" or "Standard"Fate of the Vaal

Implementation Reference

  • Main handler function for poe2_currency_check tool. Fetches currency exchange data from poe.ninja API, performs case-insensitive partial name matching against currency IDs and names, calculates chaos-equivalent values, and returns formatted results with trade volumes.
    async ({ name, league }) => {
      try {
        const data = await getNinjaExchangeOverview(league, 'Currency');
        const query = name.toLowerCase();
    
        // Build lookup: id → human-readable name from core reference items
        const coreNames = new Map<string, string>();
        for (const item of data.core.items) {
          coreNames.set(item.id, item.name);
        }
    
        const chaosRate = data.core.rates[data.core.secondary] ?? 1;
    
        // Match against core item names and line ids
        const matches: Array<{
          id: string;
          name: string;
          chaosValue: number;
          volume: number;
        }> = [];
    
        for (const line of data.lines) {
          const itemName = coreNames.get(line.id);
          const matchesQuery =
            line.id.toLowerCase().includes(query) ||
            (itemName?.toLowerCase().includes(query) ?? false);
    
          if (matchesQuery) {
            matches.push({
              id: line.id,
              name: displayName(line.id, coreNames),
              chaosValue: line.primaryValue * chaosRate,
              volume: line.volumePrimaryValue ?? 0,
            });
          }
        }
    
        if (matches.length === 0) {
          return {
            content: [
              {
                type: 'text',
                text: `No currency found matching "${name}" in ${league}.\n\nTip: Try a shorter search term like "divine", "exalted", "chaos", etc.`,
              },
            ],
          };
        }
    
        const lines: string[] = [`## Currency: "${name}" — ${league}`, ''];
        for (const match of matches) {
          lines.push(`**${match.name}** (${match.id})`);
          lines.push(`- Chaos equivalent: ${match.chaosValue.toFixed(2)}`);
          lines.push(`- Trade volume: ${match.volume}`);
          lines.push('');
        }
    
        return {
          content: [{ type: 'text', text: lines.join('\n') }],
        };
      } catch (error) {
        const msg = error instanceof Error ? error.message : String(error);
        return {
          isError: true,
          content: [{ type: 'text', text: `Error: ${msg}` }],
        };
      }
    },
  • Tool registration for poe2_currency_check, including title, description, input schema (name and league parameters), and annotations (readOnly, non-destructive, idempotent, openWorld hints).
      server.registerTool(
        'poe2_currency_check',
        {
          title: 'PoE2 Check Currency Value',
          description: `Look up the current value of a specific currency in Path of Exile 2.
    
    Searches by partial name match (case-insensitive) against currency ids and reference item names.
    
    Args:
      - name (string): Currency name or partial name, e.g. "exalted", "divine", "regal"
      - league (string): League name (default: "Fate of the Vaal")
    
    Returns: Matched currency with its chaos-equivalent value and trade volume.
    
    Examples:
      - "How much is a Divine Orb?" → name="divine"
      - "Price of Regal Orb" → name="regal"`,
          inputSchema: {
            name: z.string().min(2).describe('Currency name or partial match'),
            league: LeagueSchema,
          },
          annotations: {
            readOnlyHint: true,
            destructiveHint: false,
            idempotentHint: true,
            openWorldHint: true,
          },
        },
  • LeagueSchema definition using Zod validation with default league value 'Fate of the Vaal'.
    const LeagueSchema = z
      .string()
      .default(DEFAULT_LEAGUE)
      .describe('PoE2 league name, e.g. "Fate of the Vaal" or "Standard"');
  • API helper function getNinjaExchangeOverview that fetches PoE2 currency exchange data from poe.ninja with rate limiting support.
    export async function getNinjaExchangeOverview(
      league: string,
      type: string,
    ): Promise<NinjaExchangeResponse> {
      const url = `${NINJA_POE2_BASE}/exchange/current/overview?league=${encodeURIComponent(league)}&type=${encodeURIComponent(type)}`;
      return fetchJson<NinjaExchangeResponse>(url, ninjaLimiter);
    }
  • Helper function displayName that converts currency ID slugs to title-case format for display purposes.
    function displayName(id: string, coreNames: Map<string, string>): string {
      return coreNames.get(id) ?? id.charAt(0).toUpperCase() + id.slice(1);
    }

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/sergeyklay/poe2-mcp-server'

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