{"openapi":"3.0.3","info":{"title":"Gnist Context — SCB (Statistics Sweden)","description":"Swedish official statistics — population, labour market, national accounts, trade, prices, environment, and economic data.\n\n- **MCP endpoint:** `https://context.gnist.ai/mcp/scb/`\n- **Toolkit page:** `/toolkits/scb`\n- **Full API spec:** `/api/openapi.json`\n- **Get an API key:** `/signup`","version":"1.0.0","contact":{"name":"GnistAI","url":"https://gnist.ai"}},"servers":[{"url":"https://context.gnist.ai","description":"Production"}],"paths":{"/rest/scb/list_subjects":{"post":{"tags":["Economics"],"summary":"list_subjects","description":"List SCB's top-level statistical subject categories.\n\nSCB (Statistics Sweden) publishes thousands of tables covering population,\nlabour market, national accounts, trade, prices, environment, education,\ndemocracy, and more. This tool lists the main subject areas.\n\nUse the returned IDs with browse_subject to navigate deeper.\n\nArgs:\n    lang: Language — 'en' for English, 'sv' for Swedish (default 'en').\n\nReturns:\n    List of subject categories with id, text, and type (folder or table).","operationId":"scb_list_subjects","responses":{"200":{"description":"Successful tool call","content":{"application/json":{"schema":{"type":"object"}}}},"404":{"description":"Server or tool not found"},"500":{"description":"Tool execution error"}},"security":[{"ApiKeyHeader":[]},{"ApiKeyQuery":[]}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"lang":{"default":"en","description":"Language — 'en' for English, 'sv' for Swedish.","type":"string"}},"type":"object"}}}}}},"/rest/scb/browse_subject":{"post":{"tags":["Economics"],"summary":"browse_subject","description":"Browse a subject path to find sub-categories and tables.\n\nNavigate the SCB table hierarchy by providing a path from list_subjects\nor a previous browse_subject call. Returns child folders and tables.\n\nCommon top-level codes: AM (Labour market), BE (Population), BO (Housing),\nEN (Energy), FM (Financial markets), HA (Trade), HE (Household finances),\nHS (Health), JO (Agriculture), MI (Environment), NR (National accounts),\nNV (Business activities), PR (Prices), TK (Transport), UF (Education).\n\nWhen you reach a table (type='table'), use get_table_metadata with the\nfull path to see its dimensions and variables.\n\nArgs:\n    path: Subject path (e.g. 'BE', 'BE/BE0101', 'AM/AM0401').\n    lang: Language — 'en' or 'sv'.\n\nReturns:\n    List of items at this path — folders to navigate deeper, or tables to query.","operationId":"scb_browse_subject","responses":{"200":{"description":"Successful tool call","content":{"application/json":{"schema":{"type":"object"}}}},"404":{"description":"Server or tool not found"},"500":{"description":"Tool execution error"}},"security":[{"ApiKeyHeader":[]},{"ApiKeyQuery":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"path":{"description":"Subject path (e.g. 'BE', 'BE/BE0101', 'AM/AM0401').","type":"string"},"lang":{"default":"en","description":"Language — 'en' or 'sv'.","type":"string"}},"required":["path"],"type":"object"}}}}}},"/rest/scb/get_table_metadata":{"post":{"tags":["Economics"],"summary":"get_table_metadata","description":"Get the structure of an SCB table — its dimensions, variables, and valid values.\n\nUse this before querying data to understand what filters are available.\nEach variable lists its valid codes and labels. Variables marked 'elimination: true'\ncan be omitted from queries to get aggregated totals.\n\nTime variables are flagged with 'time: true'. Time codes follow patterns:\n'2024' (annual), '2024K3' (quarterly), '2024M06' (monthly).\n\nArgs:\n    table_path: Full path to the table (e.g. 'BE/BE0101/BE0101A/BefolkManadCKM').\n    lang: Language — 'en' or 'sv'.\n\nReturns:\n    Table title and list of variables with codes, labels, and valid values.","operationId":"scb_get_table_metadata","responses":{"200":{"description":"Successful tool call","content":{"application/json":{"schema":{"type":"object"}}}},"404":{"description":"Server or tool not found"},"500":{"description":"Tool execution error"}},"security":[{"ApiKeyHeader":[]},{"ApiKeyQuery":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"table_path":{"description":"Full path to the table (e.g. 'BE/BE0101/BE0101A/BefolkManadCKM').","type":"string"},"lang":{"default":"en","description":"Language — 'en' or 'sv'.","type":"string"}},"required":["table_path"],"type":"object"}}}}}},"/rest/scb/get_data":{"post":{"tags":["Economics"],"summary":"get_data","description":"Query data from an SCB statistical table.\n\nWithout filters, returns the latest top_n time periods for all dimensions.\nWith filters, you can select specific dimension values.\n\nEach filter dict needs: 'code' (variable code from metadata), 'filter' type,\nand 'values' list. Filter types:\n- 'item': select specific codes, e.g. {\"code\": \"Region\", \"filter\": \"item\", \"values\": [\"00\"]}\n- 'top': last N periods, e.g. {\"code\": \"Tid\", \"filter\": \"top\", \"values\": [\"5\"]}\n- 'all': all values, e.g. {\"code\": \"Kon\", \"filter\": \"all\", \"values\": [\"*\"]}\n\nExample — Sweden total population, last 5 months:\ntable_path='BE/BE0101/BE0101A/BefolkManadCKM'\nfilters=[\n    {\"code\": \"Region\", \"filter\": \"item\", \"values\": [\"00\"]},\n    {\"code\": \"Alder\", \"filter\": \"item\", \"values\": [\"tot\"]},\n    {\"code\": \"Kon\", \"filter\": \"item\", \"values\": [\"1+2\"]},\n    {\"code\": \"ContentsCode\", \"filter\": \"item\", \"values\": [\"BE0101N1\"]},\n    {\"code\": \"Tid\", \"filter\": \"top\", \"values\": [\"5\"]}\n]\n\nArgs:\n    table_path: Full path to the SCB table.\n    filters: List of dimension filters. See get_table_metadata for valid codes.\n    top_n: If no filters given, fetch this many latest time periods (default 5).\n    lang: Language — 'en' or 'sv'.\n\nReturns:\n    Parsed data with metadata (label, source, updated) and a list of records.\n    Each record has labeled dimension values and a 'value' field.","operationId":"scb_get_data","responses":{"200":{"description":"Successful tool call","content":{"application/json":{"schema":{"type":"object"}}}},"404":{"description":"Server or tool not found"},"500":{"description":"Tool execution error"}},"security":[{"ApiKeyHeader":[]},{"ApiKeyQuery":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"table_path":{"description":"Full path to the SCB table.","type":"string"},"filters":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"default":null,"description":"List of dimension filters. See get_table_metadata for valid codes."},"top_n":{"default":5,"description":"If no filters given, fetch this many latest time periods (default 5).","type":"integer"},"lang":{"default":"en","description":"Language — 'en' or 'sv'.","type":"string"}},"required":["table_path"],"type":"object"}}}}}},"/rest/scb/report_feedback":{"post":{"tags":["Economics"],"summary":"report_feedback","description":"Report a bug, feature request, or general feedback for this data source.\n\nUse this when something doesn't work as expected, when you'd like\na new feature, or when you have suggestions for improvement.\n\nArgs:\n    feedback: Describe the issue or suggestion.\n    feedback_type: One of 'bug', 'feature_request', or 'general'.","operationId":"scb_report_feedback","responses":{"200":{"description":"Successful tool call","content":{"application/json":{"schema":{"type":"object"}}}},"404":{"description":"Server or tool not found"},"500":{"description":"Tool execution error"}},"security":[{"ApiKeyHeader":[]},{"ApiKeyQuery":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"feedback":{"type":"string"},"feedback_type":{"default":"general","type":"string"}},"required":["feedback"],"type":"object"}}}}}}},"tags":[{"name":"Economics","description":"Data sources: Economics"}],"components":{"securitySchemes":{"ApiKeyHeader":{"type":"apiKey","in":"header","name":"gnist-api-key","description":"API key passed via request header."},"ApiKeyQuery":{"type":"apiKey","in":"query","name":"gnist_api_key","description":"API key passed via query parameter."}}}}