get_index_topics
Retrieve index topics from Israel Statistics API by filtering update frequency, searching by name, and customizing language, pagination, and matching methods for tailored results.
Instructions
Get index topics from Israel Statistics API
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| 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. | |
| 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. | |
| 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. |
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"
},
"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"
},
"period": {
"description": "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.",
"enum": [
"M",
"Q",
"MQ",
"QM"
],
"type": "string"
},
"searchText": {
"description": "Search for specific topics by name. For example, use 'housing' to find housing-related indices, or 'food' for food price indices.",
"type": "string"
},
"searchType": {
"description": "Search matching method. Options: contains=finds text anywhere in name (recommended) | begins_with=name starts with your text | equals=exact name match. Default: contains.",
"enum": [
"begins_with",
"contains",
"equals"
],
"type": "string"
}
},
"type": "object"
}
Implementation Reference
- src/mcp/handlers/getIndexTopics.ts:9-39 (handler)The core handler function that implements the get_index_topics tool logic. It constructs API parameters from input args, fetches data using secureFetch from the 'index/catalog/tree' endpoint, processes the response, counts the topics, and returns structured topics 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 search parameters and global pagination/language options.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:69-86 (registration)Registers the 'get_index_topics' tool with the MCP server, specifying its description, input schema, and handler invocation wrapped in rate limiting.server.registerTool( "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), }, ], } }) )