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
| Name | Required | Description | Default |
|---|---|---|---|
| country | Yes | Specify 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'), };
- src/tools/financialInstruments/index.ts:41-46 (registration)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, };