Skip to main content
Glama
reuvenaor

Israel Statistics MCP

by reuvenaor

get_main_indices_by_period

Retrieve key economic indicators from Israel's Central Bureau of Statistics for specific time periods. Filter data by date range to analyze trends in price indices and economic metrics.

Instructions

Get main indices filtered by period from Israel Statistics API

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
startDateYesStarting period in yyyymm format, e.g., '202001' for January 2020. Cannot be earlier than 199701 (January 1997).
endDateYesEnding period in yyyymm format, e.g., '202412' for December 2024. Must be later than startDate.
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 executes the tool logic: fetches main indices data by specified period from the Israel Statistics API, parses and transforms XML response into structured JSON with grouping by date.
    export async function getMainIndicesByPeriod( args: z.infer<typeof getMainIndicesByPeriodSchema> ): Promise<TransformedMainIndicesByPeriodResponse> { const params = { StartDate: args.startDate, EndDate: args.endDate, format: "xml", download: "false", } // Extract global parameters const globalParams: GlobalParams = { lang: args.lang, page: args.page, pagesize: args.pagesize, } const data = await secureFetch( "index/data/price_selected_b", params, mainIndicesByPeriodXmlResponseSchema, globalParams ) // Transform XML data to a more usable format const transformedIndices = data.indices.ind.map((indEntry) => ({ code: indEntry.code[0], // Get first element from array name: indEntry.n?.[0] || "Unknown Index", // Get first element from array (note: 'n', not 'name') percent: parseFloat(indEntry.percent[0]), // Get first element from array date: indEntry.date[0], // Get first element from array (YYYY-MM format) index: parseFloat(indEntry.index[0]), // Index value as number base: indEntry.base[0], // Base period description })) // Group by date for better organization const groupedByDate = transformedIndices.reduce( (acc, curr) => { const date = curr.date if (!acc[date]) { acc[date] = [] } acc[date].push(curr) return acc }, {} as Record<string, typeof transformedIndices> ) return { indices: transformedIndices, groupedByDate, dateRange: `${args.startDate} to ${args.endDate}`, totalIndices: transformedIndices.length, summary: `Retrieved ${transformedIndices.length} main indices from ${args.startDate} to ${args.endDate}.`, } }
  • Zod schema defining input validation for the tool: requires startDate and endDate in yyyymm format, optional global params like lang, page, pagesize.
    export const getMainIndicesByPeriodSchema = z.object({ startDate: z .string() .describe( "Starting period in yyyymm format, e.g., '202001' for January 2020. Cannot be earlier than 199701 (January 1997)." ), endDate: z .string() .describe( "Ending period in yyyymm format, e.g., '202412' for December 2024. Must be later than startDate." ), ...globalParamsSchema, explanation: z .string() .optional() .describe("Additional explanation or context for the request"), })
  • src/index.ts:206-224 (registration)
    MCP tool registration: binds the tool name 'get_main_indices_by_period' to the handler function with input schema and rate limiting wrapper.
    server.registerTool( "get_main_indices_by_period", { description: "Get main indices filtered by period from Israel Statistics API", inputSchema: getMainIndicesByPeriodSchema.shape, }, withRateLimit(async (args) => { const result = await getMainIndicesByPeriod(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