get_school_types
Retrieve all available school types from Skolverket's official classification system to filter educational data and understand Swedish school categories.
Instructions
Hämta lista över alla skoltyper.
ANVÄNDNINGSFALL:
Se tillgängliga skolformer
Förstå Skolverkets kategorisering
Filtrera data efter skoltyp
RETURNERAR: Lista över skoltyper med koder och namn.
VÄRDEN: GR (Grundskola), GY (Gymnasium), VUX (Vuxenutbildning), GRSÄR (Grundsärskola), GYSÄR (Gymnasiesärskola).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| includeExpired | No |
Implementation Reference
- src/tools/syllabus/valuestore.ts:22-56 (handler)Main handler function for the 'get_school_types' tool. Fetches active school types and optionally expired ones from the syllabus API, formats as JSON text response, handles errors.export async function getSchoolTypes(params: { includeExpired?: boolean; }) { try { const activeTypes = await syllabusApi.getSchoolTypes(); let expiredTypes: any[] = []; if (params.includeExpired) { expiredTypes = await syllabusApi.getExpiredSchoolTypes(); } return { content: [ { type: 'text' as const, text: JSON.stringify({ activeSchoolTypes: activeTypes, expiredSchoolTypes: params.includeExpired ? expiredTypes : undefined, total: activeTypes.length + expiredTypes.length }, null, 2) } ] }; } catch (error) { return { content: [ { type: 'text' as const, text: `Fel vid hämtning av skoltyper: ${error instanceof Error ? error.message : String(error)}` } ], isError: true }; } }
- Input schema for getSchoolTypes using Zod validation for optional includeExpired boolean parameter.export const getSchoolTypesSchema = { includeExpired: z.boolean().optional().default(false).describe('Inkludera utgångna skoltyper') };
- src/http-server.ts:65-65 (registration)Tool registration in the HTTP server's tools registry, mapping 'get_school_types' to the getSchoolTypes handler function.get_school_types: getSchoolTypes,
- src/api/syllabus-client.ts:111-118 (helper)Helper method in SyllabusApiClient that fetches active school types from Skolverket API with 24-hour caching.async getSchoolTypes(): Promise<SchoolType[]> { const response = await this.getCached<{ schoolTypes: SchoolType[] }>( '/v1/valuestore/schooltypes', undefined, 86400000 // 24 timmar cache ); return response.schoolTypes || []; }