Skip to main content
Glama

get_main_indices

Retrieve main economic indices from Israel Statistics API by specifying language, pagination, and optional legacy formatting for accurate, structured data access.

Instructions

Get main indices by different bases from Israel Statistics API

Input Schema

NameRequiredDescriptionDefault
explanationNoAdditional explanation or context for the request
langNoLanguage for response. Options: he=Hebrew (default) | en=English. Use 'en' for English responses.
oldFormatNoSet to true if you need Hebrew text and the legacy display format. Use false (default) for English text and modern formatting.
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.

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "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

  • The handler function that executes the core logic for fetching, transforming, and returning main indices data from the Israel Statistics API.
    export async function getMainIndices( args?: z.infer<typeof getMainIndicesSchema> ): Promise<TransformedMainIndicesResponse> { const params: Record<string, string> = { format: "json", download: "false", } if (args?.oldFormat) params.oldformat = "true" // Extract global parameters const globalParams: GlobalParams = { lang: args?.lang, page: args?.page, pagesize: args?.pagesize, } const data = await secureFetch( "index/data/price_selected", params, mainIndicesXmlResponseSchema, globalParams ) // Transform XML data to a more usable format - handle all elements properly const transformedIndices = data.indices.date.flatMap((dateEntry) => dateEntry.code.map((codeEntry) => ({ code: codeEntry.code[0], // Single value per code entry name: codeEntry.name[0], // Single value per code entry percent: parseFloat(codeEntry.percent[0]), // Single value per code entry year: dateEntry.year[0], // Single value per date entry month: dateEntry.month[0], // Single value per date entry indices: codeEntry.index.map((idx) => ({ value: parseFloat(idx._), // Text content, not in array base: idx.base[0], // Attributes are in arrays with explicitArray:true chainingCoefficient: idx.chainingCoefficient ? parseFloat(idx.chainingCoefficient[0]) : undefined, })), })) ) return { indices: transformedIndices, updateDate: data.indices.UpdateDate[0], summary: `Retrieved ${transformedIndices.length} main indices updated on ${data.indices.UpdateDate[0]}.`, } }
  • Zod schema defining input validation for the get_main_indices tool, including optional oldFormat and global parameters like lang, page, pagesize.
    export const getMainIndicesSchema = z.object({ oldFormat: oldFormatSchema.optional(), ...globalParamsSchema, explanation: z .string() .optional() .describe("Additional explanation or context for the request"), })
  • src/index.ts:186-204 (registration)
    MCP server registration of the 'get_main_indices' tool, linking the schema and handler with rate limiting wrapper.
    server.registerTool( "get_main_indices", { description: "Get main indices by different bases from Israel Statistics API", inputSchema: getMainIndicesSchema.shape, }, withRateLimit(async (args) => { const result = await getMainIndices(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