get_all_indices
Retrieve all price indices from Israel's Central Bureau of Statistics with optional filtering by category, language selection, and pagination controls.
Instructions
Get all indices by different bases with optional chapter filtering from Israel Statistics API
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| oldFormat | No | Set to true if you need Hebrew text and the legacy display format. Use false (default) for English text and modern formatting. | |
| 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. | |
| lang | No | Language for response. Options: he=Hebrew (default) | en=English. Use 'en' for English responses. | |
| 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. | |
| explanation | No | Additional explanation or context for the request |
Implementation Reference
- src/mcp/handlers/getAllIndices.ts:10-55 (handler)The main asynchronous handler function that executes the 'get_all_indices' tool logic. It constructs API parameters, fetches data using secureFetch from 'index/data/price_all', counts total indices, handles housing warnings, and returns the indices data with a summary.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)Registration of the 'get_all_indices' tool in the MCP server, specifying the name, description, input schema, and a rate-limited wrapper around the handler function.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), }, ], } }) )