get_index_topics
Retrieve economic index topics from Israel's Central Bureau of Statistics, enabling users to search and filter by frequency, topic name, and language for comprehensive data analysis.
Instructions
Get index topics from Israel Statistics API
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| period | No | Filter indices by update frequency. Options: M=monthly data only | Q=quarterly data only | MQ=both monthly and quarterly (most comprehensive) | QM=quarterly and monthly. Default shows all. | |
| searchText | No | Search for specific topics by name. For example, use 'housing' to find housing-related indices, or 'food' for food price indices. | |
| searchType | No | Search matching method. Options: contains=finds text anywhere in name (recommended) | begins_with=name starts with your text | equals=exact name match. Default: contains. | |
| 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/getIndexTopics.ts:9-39 (handler)The core handler function that implements the logic for fetching index topics from the Israel Statistics API. It constructs parameters, calls secureFetch to the 'index/catalog/tree' endpoint, processes the response by counting topics, and returns structured data with a summary.export async function getIndexTopics( args?: z.infer<typeof getIndexTopicsSchema> ): Promise<TransformedIndexTopicsResponse> { const params: Record<string, string> = { format: "json", download: "false", } if (args?.period) params.period = args.period if (args?.searchText) params.q = args.searchText if (args?.searchType) params.string_match_type = args.searchType // Extract global parameters const globalParams: GlobalParams = { lang: args?.lang, page: args?.page, pagesize: args?.pagesize, } const data = await secureFetch( "index/catalog/tree", params, indexTopicsResponseSchema, globalParams ) // Add statistical benefit: count topics const topicCount = data.chapters.flatMap((c) => c.subject.flatMap((s) => s.code) ).length return { topics: data.chapters, summary: `Found ${topicCount} index codes.` } }
- src/schemas/request.schema.ts:32-46 (schema)Zod schema defining the input shape for the get_index_topics tool, including optional parameters like period, searchText, searchType, global params (lang, page, pagesize), and explanation.export const getIndexTopicsSchema = z.object({ period: periodSchema.optional(), searchText: z .string() .optional() .describe( "Search for specific topics by name. For example, use 'housing' to find housing-related indices, or 'food' for food price indices." ), searchType: searchTypeSchema.optional(), ...globalParamsSchema, explanation: z .string() .optional() .describe("Additional explanation or context for the request"), })
- src/index.ts:70-86 (registration)Registration of the 'get_index_topics' tool in the MCP server, specifying description, input schema, and a rate-limited wrapper that calls the handler and returns JSON stringified result as text content."get_index_topics", { description: "Get index topics from Israel Statistics API", inputSchema: getIndexTopicsSchema.shape, }, withRateLimit(async (args) => { const result = await getIndexTopics(args) return { content: [ { type: "text", text: JSON.stringify(result), }, ], } }) )