Skip to main content
Glama

Marketstack MCP Server

by matteoantoci
getTickerInfo.ts1.58 kB
import { z } from 'zod'; import type { MarketstackClient, MarketstackApiParams } from '../../marketstackClient.js'; // Define the input schema shape for the Ticker Info tool const getTickerInfoInputSchemaShape = { ticker: z.string().describe('To get results based on a ticker.'), }; type RawSchemaShape = typeof getTickerInfoInputSchemaShape; type Input = z.infer<z.ZodObject<RawSchemaShape>>; type Output = any; // TODO: Define a more specific output type based on Marketstack response // Define the handler function for the Ticker Info tool const getTickerInfoHandler = async (input: Input, client: MarketstackClient): Promise<Output> => { try { const { ticker } = input; const apiRequestParams: MarketstackApiParams = { endpoint: 'tickerinfo', ticker, }; const data = await client.fetchApiData(apiRequestParams); return data; } catch (error: unknown) { console.error('getTickerInfo tool error:', error); const message = error instanceof Error ? error.message : 'An unknown error occurred.'; throw new Error(`getTickerInfo tool failed: ${message}`); } }; // Define the tool definition object structure type MarketstackToolDefinition = { name: string; description: string; inputSchemaShape: RawSchemaShape; handler: (input: Input, client: MarketstackClient) => Promise<Output>; }; export const getTickerInfoTool: MarketstackToolDefinition = { name: 'get_ticker_info', description: 'Look up information about tickers.', inputSchemaShape: getTickerInfoInputSchemaShape, handler: getTickerInfoHandler, };

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/matteoantoci/mcp-marketstack'

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