Skip to main content
Glama
shlomico-tr

eToro MCP Server

Official
by shlomico-tr

fetch_instrument_details

Retrieve detailed information for specified eToro instruments using the MCP server, enabling efficient access to instrument data for analysis and trading decisions.

Instructions

Fetch details for a list of eToro instruments

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function for the 'fetch_instrument_details' tool. It takes instrumentIds and fields, constructs a query to the eToro API, performs a GET request with specific headers to bypass CORS, parses the JSON response, and returns it as formatted text content.
    }, async (params) => {
        const { instrumentIds, fields } = params;
        try {
            const instrumentIdsString = instrumentIds.join(',');
            const fieldsString = fields.join(',');
            // This should be run server-side due to CORS limitations
            const response = await fetch(`https://www.etoro.com/sapi/instrumentsinfo/Instruments?internalInstrumentId=${instrumentIdsString}&fields=${fieldsString}`, {
                method: 'GET',
                headers: {
                    'accept': 'application/json, text/plain, */*',
                    'accept-language': 'en-US,en;q=0.9',
                    'cache-control': 'no-cache',
                    'pragma': 'no-cache',
                    'priority': 'u=1, i',
                    'sec-ch-ua': '"Not(A:Brand";v="99", "Google Chrome";v="133", "Chromium";v="133"',
                    'sec-ch-ua-mobile': '?0',
                    'sec-ch-ua-platform': '"Windows"',
                    'sec-fetch-dest': 'empty',
                    'sec-fetch-mode': 'cors',
                    'sec-fetch-site': 'same-origin',
                    'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36',
                }
            });
            if (!response.ok) {
                throw new Error(`Failed to fetch instrument details: ${response.statusText}`);
            }
            const instrumentData = await response.json();
            return {
                content: [{
                        type: "text",
                        text: JSON.stringify(instrumentData, null, 2)
                    }],
            };
        }
        catch (error) {
            if (error instanceof Error) {
                throw new Error(`Failed to fetch instrument details: ${error.message}`);
            }
            throw error;
        }
    });
  • Zod schema defining the input parameters for the tool: an array of instrument IDs (required) and an array of fields (optional with default).
    instrumentIds: z.array(z.number()).describe("List of instrument IDs to fetch details for"),
    fields: z.array(z.string())
        .default(['displayname', 'threeMonthPriceChange', 'oneYearPriceChange', 'lastYearPriceChange'])
        .describe("Fields to include in the response")
  • dist/index.js:136-136 (registration)
    The registration of the 'fetch_instrument_details' tool on the MCP server using server.tool(name, description, schema, handler).
    server.tool("fetch_instrument_details", "Fetch details for a list of eToro instruments", {
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/shlomico-tr/etoroPortfolioMCP'

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