Skip to main content
Glama
inflation.ts2.34 kB
import { PaginationSchema } from "../schemas/common.js"; import { InflationMonthYearSchema, InflationDateRangeSchema } from "../schemas/inflation.js"; import { InflationType, PaginatedInflationType, InflationErrorResponseType } from "../types.js"; import { BaseTool } from "./tool.interface.js"; export class InflationTool extends BaseTool { protected initTools(): void { this.server.tool( "get_inflation_data", PaginationSchema, async ({ page = 1, sizePerPage = 50, sort = "asc" }) => { const data = await this.httpClient.get<InflationType | PaginatedInflationType | InflationErrorResponseType>( `/inflation?page=${page}&size=${sizePerPage}&sort=${sort}` ); return { content: [{ type: "text", text: JSON.stringify(data) }], }; } ); this.server.tool( "get_inflation_data_by_specific_month", InflationMonthYearSchema, async ({ month, year }) => { const data = await this.httpClient.get<InflationType | InflationErrorResponseType>( `/inflation/${year}/${month}` ); return { content: [{ type: "text", text: JSON.stringify(data) }], }; } ); this.server.tool( "get_inflation_data_by_range_dates", InflationDateRangeSchema, async ({ startMonth, startYear, endMonth, endYear, page, sizePerPage, sort }) => { const params = new URLSearchParams({ start_year: startYear.toString(), start_month: startMonth.toString(), end_year: endYear.toString(), end_month: endMonth.toString(), sort, page: page.toString(), size: sizePerPage.toString(), }); const data = await this.httpClient.get<PaginatedInflationType | InflationErrorResponseType>( `/inflation/date-range?${params.toString()}` ); return { content: [{ type: "text", text: JSON.stringify(data) }], }; } ); } }

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/kevyder/banrepco_mcp'

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