Skip to main content
Glama
reuvenaor

Israel Statistics MCP

by reuvenaor

get_index_data

Retrieve price index data from Israel's Central Bureau of Statistics for specific codes and date ranges to analyze economic trends and inflation.

Instructions

Get index data from Israel Statistics API

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesThe index code (numeric string) you want price data for. Get this code first from getSubjectCodes or getIndexTopics. Example: '120010' for general CPI.
startPeriodNoStarting period in mm-yyyy format like '01-2020' for January 2020. Leave empty to get data from the beginning of the series.
endPeriodNoEnding period in mm-yyyy format like '12-2024' for December 2024. Leave empty to get data up to the most recent available.
formatNoResponse format. Options: json=JSON format (recommended, default) | xml=XML format. Use json unless you specifically need XML.
lastNoGet only the N most recent data points instead of the full series. Useful for getting just the latest values, e.g., use 12 for the last year of monthly data.
coefNoSet to true to include linkage coefficients for inflation calculations. Only needed if you plan to do manual price adjustments.
langNoLanguage for response. Options: he=Hebrew (default) | en=English. Use 'en' for English responses.
pageNoPage number for pagination. Start with 1 for first page. Use with pagesize to navigate large result sets.
pagesizeNoNumber of results per page (maximum 1000). Controls how many items to return. Use with page for pagination.
explanationNoAdditional explanation or context for the request

Implementation Reference

  • The core handler function that implements the get_index_data tool logic: constructs API parameters, fetches data using secureFetch, processes statistics like average value, adds housing warnings, and returns data with summary.
    export async function getIndexData(args: z.infer<typeof getIndexDataSchema>) { const params: Record<string, string> = { id: args.code, format: args.format || "json", download: "false", } if (args.startPeriod) params.startPeriod = args.startPeriod if (args.endPeriod) params.endPeriod = args.endPeriod if (args.last) params.last = args.last.toString() if (args.coef) params.coef = args.coef.toString() // Extract global parameters const globalParams: GlobalParams = { lang: args.lang, page: args.page, pagesize: args.pagesize, } const endpoint = `index/data/price` const data = await secureFetch( endpoint, params, indexDataResponseSchema, globalParams ) // Transform the data structure and extract values for statistics const allDataPoints = data.month?.[0]?.date || [] const values = allDataPoints.map((d) => d.currBase.value) const avg = values.length > 0 ? values.reduce((a, b) => a + b, 0) / values.length : 0 // Check for housing-related warnings const housingWarning = checkHousingWarnings( undefined, args.code, data.month?.[0]?.name ) const baseSummary = `Retrieved ${allDataPoints.length} data points. Average value: ${avg.toFixed(2)}.` return { data, summary: addHousingWarningsToSummary(baseSummary, housingWarning), } }
  • Input schema validation using Zod for the get_index_data tool parameters, including required code and optional filters like periods, format, last N points, coefficients, and global params.
    export const getIndexDataSchema = z.object({ code: z .string() .describe( "The index code (numeric string) you want price data for. Get this code first from getSubjectCodes or getIndexTopics. Example: '120010' for general CPI." ), startPeriod: z .string() .optional() .describe( "Starting period in mm-yyyy format like '01-2020' for January 2020. Leave empty to get data from the beginning of the series." ), endPeriod: z .string() .optional() .describe( "Ending period in mm-yyyy format like '12-2024' for December 2024. Leave empty to get data up to the most recent available." ), format: formatSchema.optional(), last: z .number() .optional() .describe( "Get only the N most recent data points instead of the full series. Useful for getting just the latest values, e.g., use 12 for the last year of monthly data." ), coef: z .boolean() .optional() .describe( "Set to true to include linkage coefficients for inflation calculations. Only needed if you plan to do manual price adjustments." ), ...globalParamsSchema, explanation: z .string() .optional() .describe("Additional explanation or context for the request"), })
  • src/index.ts:87-104 (registration)
    MCP tool registration for 'get_index_data', specifying description, input schema, and handler invocation wrapped in rate limiting.
    server.registerTool( "get_index_data", { description: "Get index data from Israel Statistics API", inputSchema: getIndexDataSchema.shape, }, withRateLimit(async (args) => { const result = await getIndexData(args) return { content: [ { type: "text", text: JSON.stringify(result), }, ], } }) )

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/reuvenaor/israel-statistics-mcp'

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