Skip to main content
Glama

Marketstack MCP Server

by matteoantoci
getBondInfo.ts1.61 kB
import { z } from 'zod'; import type { MarketstackClient, MarketstackApiParams } from '../../marketstackClient.js'; // Define the input schema shape for the Bond Info tool const getBondInfoInputSchemaShape = { country: z.string().describe('Specify your country for your request, e.g. kenya or united%20states'), }; type RawSchemaShape = typeof getBondInfoInputSchemaShape; 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 Bond Info tool const getBondInfoHandler = async (input: Input, client: MarketstackClient): Promise<Output> => { try { const { country } = input; const apiRequestParams: MarketstackApiParams = { endpoint: 'bond', country, }; const data = await client.fetchApiData(apiRequestParams); return data; } catch (error: unknown) { console.error('getBondInfo tool error:', error); const message = error instanceof Error ? error.message : 'An unknown error occurred.'; throw new Error(`getBondInfo 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 getBondInfoTool: MarketstackToolDefinition = { name: 'get_bond_info', description: 'Get real-time government bond data for a specific country.', inputSchemaShape: getBondInfoInputSchemaShape, handler: getBondInfoHandler, };

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