Skip to main content
Glama
matteoantoci

Marketstack MCP Server

by matteoantoci

get_bond_info

Retrieve real-time government bond data for any specified country using the Marketstack MCP Server. Simplify financial analysis with accurate bond information.

Instructions

Get real-time government bond data for a specific country.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
countryYesSpecify your country for your request, e.g. kenya or united%20states

Implementation Reference

  • The async handler function that implements the core logic of the 'get_bond_info' tool, fetching government bond data for a specified country using the MarketstackClient API.
    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}`);
      }
    };
  • The Zod input schema shape for the 'get_bond_info' tool, defining the required 'country' parameter.
    const getBondInfoInputSchemaShape = {
      country: z.string().describe('Specify your country for your request, e.g. kenya or united%20states'),
    };
  • The registration of the 'get_bond_info' tool on the MCP server using server.tool(), wrapping the handler with wrapToolHandler.
    server.tool(
      getBondInfoTool.name,
      getBondInfoTool.description,
      getBondInfoTool.inputSchemaShape,
      wrapToolHandler((input) => getBondInfoTool.handler(input, client))
    );
  • The tool definition object exporting the name, description, schema, and handler for 'get_bond_info', used in registration.
    export const getBondInfoTool: MarketstackToolDefinition = {
      name: 'get_bond_info',
      description: 'Get real-time government bond data for a specific country.',
      inputSchemaShape: getBondInfoInputSchemaShape,
      handler: getBondInfoHandler,
    };

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

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