get_chapter_topics
Retrieve specific economic data topics from Israel's Central Bureau of Statistics by selecting a chapter category like Consumer Price Index or Housing Market Index.
Instructions
Get topics for a specific chapter from Israel Statistics API
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chapterId | Yes | 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
- The main handler function that executes the tool logic: extracts params, fetches chapter topics via secureFetch from 'index/catalog/chapter' endpoint, adds housing warnings to summary, and returns topics array with summary.export async function getChapterTopics( args: z.infer<typeof getChapterTopicsSchema> ) { // Extract global parameters const globalParams: GlobalParams = { lang: args.lang, page: args.page, pagesize: args.pagesize, } const data = await secureFetch( "index/catalog/chapter", { id: args.chapterId, format: "json", download: "false" }, chapterTopicsResponseSchema, globalParams ) // Check for housing-related warnings const housingWarning = checkHousingWarnings(args.chapterId) const baseSummary = `Found ${data.subject.length} topics in chapter ${args.chapterId}.` return { topics: data.subject, summary: addHousingWarningsToSummary(baseSummary, housingWarning), } }
- src/schemas/request.schema.ts:56-63 (schema)Input schema using Zod: requires chapterId (number), optional lang, page, pagesize, explanation.export const getChapterTopicsSchema = z.object({ chapterId: chapterSchema, ...globalParamsSchema, explanation: z .string() .optional() .describe("Additional explanation or context for the request"), })
- src/index.ts:126-144 (registration)Registers the tool named 'get_chapter_topics' with the MCP server, providing description, inputSchema from getChapterTopicsSchema, and a rate-limited wrapper that calls the handler and returns JSON stringified result as text content.server.registerTool( "get_chapter_topics", { description: "Get topics for a specific chapter from Israel Statistics API", inputSchema: getChapterTopicsSchema.shape, }, withRateLimit(async (args) => { const result = await getChapterTopics(args) return { content: [ { type: "text", text: JSON.stringify(result), }, ], } }) )