Skip to main content
Glama
shlomico-tr

eToro MCP Server

Official
by shlomico-tr

search_instruments

Use this tool to find eToro instruments by name prefix, enabling quick autocomplete functionality for efficient instrument lookup and selection.

Instructions

Search for eToro instruments by name prefix (autocomplete)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler function that performs an HTTP GET request to the eToro API endpoint for instruments matching the name prefix, using the specified fields, and returns the JSON results as a markdown text content block.
    }, async (params) => { const { namePrefix, fields } = params; try { 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?displayname=${encodeURIComponent(namePrefix)}&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 search instruments: ${response.statusText}`); } const searchResults = await response.json(); return { content: [{ type: "text", text: JSON.stringify(searchResults, null, 2) }], }; } catch (error) { if (error instanceof Error) { throw new Error(`Failed to search instruments: ${error.message}`); } throw error; }
  • Zod input schema defining parameters for the tool: required namePrefix (string) and optional fields (array of strings with default).
    namePrefix: z.string().describe("The prefix to search for in instrument names"), fields: z.array(z.string()) .default(['internalInstrumentId', 'displayname', 'internalClosingPrice']) .describe("Fields to include in the response")
  • dist/index.js:183-227 (registration)
    Registration of the 'search_instruments' tool on the MCP server using server.tool(), including description, input schema, and inline handler function.
    server.tool("search_instruments", "Search for eToro instruments by name prefix (autocomplete)", { namePrefix: z.string().describe("The prefix to search for in instrument names"), fields: z.array(z.string()) .default(['internalInstrumentId', 'displayname', 'internalClosingPrice']) .describe("Fields to include in the response") }, async (params) => { const { namePrefix, fields } = params; try { 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?displayname=${encodeURIComponent(namePrefix)}&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 search instruments: ${response.statusText}`); } const searchResults = await response.json(); return { content: [{ type: "text", text: JSON.stringify(searchResults, null, 2) }], }; } catch (error) { if (error instanceof Error) { throw new Error(`Failed to search instruments: ${error.message}`); } throw error; } });

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