Skip to main content
Glama

get_index_data

Retrieve price index data from the Israel Central Bureau of Statistics API by specifying index code, time range, and format. Use to analyze economic trends or perform inflation calculations.

Instructions

Get index data from Israel Statistics API

Input 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.
coefNoSet to true to include linkage coefficients for inflation calculations. Only needed if you plan to do manual price adjustments.
endPeriodNoEnding period in mm-yyyy format like '12-2024' for December 2024. Leave empty to get data up to the most recent available.
explanationNoAdditional explanation or context for the request
formatNoResponse format. Options: json=JSON format (recommended, default) | xml=XML format. Use json unless you specifically need XML.
langNoLanguage for response. Options: he=Hebrew (default) | en=English. Use 'en' for English responses.
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.
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.
startPeriodNoStarting period in mm-yyyy format like '01-2020' for January 2020. Leave empty to get data from the beginning of the series.

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "code": { "description": "The index code (numeric string) you want price data for. Get this code first from getSubjectCodes or getIndexTopics. Example: '120010' for general CPI.", "type": "string" }, "coef": { "description": "Set to true to include linkage coefficients for inflation calculations. Only needed if you plan to do manual price adjustments.", "type": "boolean" }, "endPeriod": { "description": "Ending period in mm-yyyy format like '12-2024' for December 2024. Leave empty to get data up to the most recent available.", "type": "string" }, "explanation": { "description": "Additional explanation or context for the request", "type": "string" }, "format": { "description": "Response format. Options: json=JSON format (recommended, default) | xml=XML format. Use json unless you specifically need XML.", "enum": [ "json", "xml" ], "type": "string" }, "lang": { "description": "Language for response. Options: he=Hebrew (default) | en=English. Use 'en' for English responses.", "enum": [ "he", "en" ], "type": "string" }, "last": { "description": "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.", "type": "number" }, "page": { "description": "Page number for pagination. Start with 1 for first page. Use with pagesize to navigate large result sets.", "minimum": 1, "type": "number" }, "pagesize": { "description": "Number of results per page (maximum 1000). Controls how many items to return. Use with page for pagination.", "maximum": 1000, "minimum": 1, "type": "number" }, "startPeriod": { "description": "Starting period in mm-yyyy format like '01-2020' for January 2020. Leave empty to get data from the beginning of the series.", "type": "string" } }, "required": [ "code" ], "type": "object" }

Implementation Reference

  • The main handler function that fetches index data from the Israel Statistics API endpoint `/index/data/price`, processes the response to compute statistics like average value, checks for housing warnings, and returns the data with a 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), } }
  • Zod schema defining the input parameters for the get_index_data tool, including code, periods, format, last N points, coefficients, global params, and explanation.
    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 server registration of the 'get_index_data' tool, specifying its description, input schema, and the wrapped handler function that invokes getIndexData and formats the response.
    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), }, ], } }) )

Other Tools

Related Tools

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