get_study_path_codes
Retrieve Swedish upper secondary school program codes to identify educational pathways, filter by school type or program category, and access official study path identifiers for educational planning and data analysis.
Instructions
Hämta studievägskodar (programkoder).
ANVÄNDNINGSFALL:
Lista alla gymnasieprogram
Hitta programkoder
Filtrera efter typ
RETURNERAR: Lista över studievägar med koder.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| schooltype | No | ||
| timespan | No | ||
| studyPathType | No |
Implementation Reference
- src/tools/syllabus/valuestore.ts:116-155 (handler)The handler function that implements the core logic of the 'get_study_path_codes' tool. It calls the syllabus API, formats the response as JSON, and handles errors.export async function getStudyPathCodes(params: { schooltype?: string; timespan?: 'LATEST' | 'FUTURE' | 'EXPIRED' | 'MODIFIED'; date?: string; typeOfStudyPath?: string; typeOfProgram?: string; }) { try { const codes = await syllabusApi.getStudyPathCodes(params); return { content: [ { type: 'text' as const, text: JSON.stringify({ studyPathCodes: codes, total: codes.length, filters: { schooltype: params.schooltype, timespan: params.timespan, date: params.date, typeOfStudyPath: params.typeOfStudyPath, typeOfProgram: params.typeOfProgram } }, null, 2) } ] }; } catch (error) { return { content: [ { type: 'text' as const, text: `Fel vid hämtning av studievägskodar: ${error instanceof Error ? error.message : String(error)}` } ], isError: true }; } }
- Input schema using Zod for validating parameters to the getStudyPathCodes tool.export const getStudyPathCodesSchema = { schooltype: z.string().optional().describe('Filtrera på skoltyp (t.ex. "GY" för gymnasium)'), timespan: z.enum(['LATEST', 'FUTURE', 'EXPIRED', 'MODIFIED']).optional().default('LATEST').describe('Tidsperiod: LATEST (gällande), FUTURE (framtida), EXPIRED (utgångna), MODIFIED (ändrade)'), date: z.string().optional().describe('Datum i formatet YYYY-MM-DD för att hämta studievägar som var giltiga vid det datumet'), typeOfStudyPath: z.string().optional().describe('Typ av studieväg (t.ex. "PROGRAM" för gymnasieprogram)'), typeOfProgram: z.string().optional().describe('Typ av program (t.ex. "HÖGSKOLEFÖRBEREDANDE", "YRKES")') };
- src/http-server.ts:68-68 (registration)Registration of the tool 'get_study_path_codes' mapping to the getStudyPathCodes handler function in the tools registry.get_study_path_codes: getStudyPathCodes,
- src/http-server.ts:26-26 (registration)Import statement bringing in the getStudyPathCodes function for tool registration.import { getSchoolTypes, getTypesOfSyllabus, getSubjectAndCourseCodes, getStudyPathCodes, getApiInfo } from './tools/syllabus/valuestore.js';
- src/api/syllabus-client.ts:147-154 (helper)Underlying API client method called by the tool handler to fetch study path codes from Skolverket's API with caching.async getStudyPathCodes(params: StudyPathSearchParams = {}): Promise<StudyPathCode[]> { const response = await this.getCached<{ studyPaths: StudyPathCode[] }>( '/v1/valuestore/studypathcodes', params, 86400000 // 24 timmar cache ); return response.studyPaths || []; }