get_all_indices
Retrieve all price and economic indices from Israel Statistics API, filtered by category and formatted in English or Hebrew. Supports pagination for large datasets.
Instructions
Get all indices by different bases with optional chapter filtering from Israel Statistics API
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chapter | No | Index category filter. Options: a=Consumer Price Index (groceries, retail) | aa=Housing Market Index | b=Producer Price Index Industrial | ba=Producer Price Index Exports | bb=Producer Price Index Services | c=Residential Building Input | ca=Commercial Building Input | d=Road Construction Input | e=Agriculture Input | f=Bus Input | fa=Public Minibus Input. Leave empty for all. | |
| explanation | No | Additional explanation or context for the request | |
| lang | No | Language for response. Options: he=Hebrew (default) | en=English. Use 'en' for English responses. | |
| oldFormat | No | Set to true if you need Hebrew text and the legacy display format. Use false (default) for English text and modern formatting. | |
| page | No | Page number for pagination. Start with 1 for first page. Use with pagesize to navigate large result sets. | |
| pagesize | No | Number of results per page (maximum 1000). Controls how many items to return. Use with page for pagination. |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"chapter": {
"description": "Index category filter. Options: a=Consumer Price Index (groceries, retail) | aa=Housing Market Index | b=Producer Price Index Industrial | ba=Producer Price Index Exports | bb=Producer Price Index Services | c=Residential Building Input | ca=Commercial Building Input | d=Road Construction Input | e=Agriculture Input | f=Bus Input | fa=Public Minibus Input. Leave empty for all.",
"enum": [
"a",
"aa",
"b",
"ba",
"bb",
"c",
"ca",
"d",
"e",
"f",
"fa"
],
"type": "string"
},
"explanation": {
"description": "Additional explanation or context for the request",
"type": "string"
},
"lang": {
"description": "Language for response. Options: he=Hebrew (default) | en=English. Use 'en' for English responses.",
"enum": [
"he",
"en"
],
"type": "string"
},
"oldFormat": {
"description": "Set to true if you need Hebrew text and the legacy display format. Use false (default) for English text and modern formatting.",
"type": "boolean"
},
"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"
}
},
"type": "object"
}
Implementation Reference
- src/mcp/handlers/getAllIndices.ts:10-55 (handler)The core handler function that implements the get_all_indices tool logic. It fetches index data from the 'index/data/price_all' endpoint, handles parameters like oldFormat and chapter, processes the response, counts total indices, adds housing warnings to the summary, and returns the indices data.export async function getAllIndices( args?: z.infer<typeof getAllIndicesSchema> ) { const params: Record<string, string> = { format: "xml", download: "false", } if (args?.oldFormat) params.oldformat = "true" if (args?.chapter) params.chapter = args.chapter // Extract global parameters const globalParams: GlobalParams = { lang: args?.lang, page: args?.page, pagesize: args?.pagesize, } const data = await secureFetch( "index/data/price_all", params, allIndicesResponseSchema, globalParams ) // Check for housing-related warnings const housingWarning = checkHousingWarnings(args?.chapter) const chapterFilter = args?.chapter ? ` for chapter ${args.chapter}` : "" // Count total indices across all chapters const totalIndices = data.indices.chapter.reduce((total, chapter) => { return ( total + (chapter.month?.reduce((monthTotal, monthData) => { return monthTotal + monthData.index.length }, 0) || 0) ) }, 0) const baseSummary = `Retrieved ${totalIndices} indices${chapterFilter}.` return { indices: data.indices, summary: addHousingWarningsToSummary(baseSummary, housingWarning), } }
- Zod schema defining the input parameters for the get_all_indices tool, including optional oldFormat, chapter filter, global params like lang, page, pagesize, and explanation.export const getAllIndicesSchema = z.object({ oldFormat: oldFormatSchema.optional(), chapter: chapterSchema.optional(), ...globalParamsSchema, explanation: z .string() .optional() .describe("Additional explanation or context for the request"), })
- src/index.ts:226-244 (registration)MCP server registration of the 'get_all_indices' tool, including its description, input schema, and handler invocation wrapped with rate limiting.server.registerTool( "get_all_indices", { description: "Get all indices by different bases with optional chapter filtering from Israel Statistics API", inputSchema: getAllIndicesSchema.shape, }, withRateLimit(async (args) => { const result = await getAllIndices(args) return { content: [ { type: "text", text: JSON.stringify(result), }, ], } }) )