get_education_areas
Retrieve all available educational areas to filter program searches and explore Sweden's educational offerings through official Skolverket data.
Instructions
Hämta alla utbildningsområden.
ANVÄNDNINGSFALL:
Se tillgängliga områden
Filtrera utbildningssökningar
Utforska utbildningsutbud
RETURNERAR: Lista över utbildningsområden.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The main handler function for the 'get_education_areas' tool. It calls the Planned Education API to fetch education areas and returns the JSON response as text content, or an error message if failed.export async function getEducationAreas() { try { const response = await plannedEducationApi.getEducationAreas(); if (response.status !== 'OK') { throw new Error(response.message || 'Okänt fel från API'); } return { content: [ { type: 'text' as const, text: JSON.stringify(response.body, null, 2) } ] }; } catch (error) { return { content: [ { type: 'text' as const, text: `Fel vid hämtning av utbildningsområden: ${error instanceof Error ? error.message : String(error)}` } ], isError: true }; } }
- Zod schema for the tool input parameters (empty object since the tool takes no arguments).export const getEducationAreasSchema = {};
- src/http-server.ts:51-87 (registration)Registration of the tool in the HTTP server's tools registry map, mapping 'get_education_areas' to the getEducationAreas handler function.const tools: Record<string, (args: any) => Promise<any>> = { // Syllabus API search_subjects: searchSubjects, get_subject_details: getSubjectDetails, get_subject_versions: getSubjectVersions, search_courses: searchCourses, get_course_details: getCourseDetails, get_course_versions: getCourseVersions, search_programs: searchPrograms, get_program_details: getProgramDetails, get_program_versions: getProgramVersions, search_curriculums: searchCurriculums, get_curriculum_details: getCurriculumDetails, get_curriculum_versions: getCurriculumVersions, get_school_types: getSchoolTypes, get_types_of_syllabus: getTypesOfSyllabus, get_subject_and_course_codes: getSubjectAndCourseCodes, get_study_path_codes: getStudyPathCodes, get_api_info: getApiInfo, // School Units API search_school_units: searchSchoolUnits, get_school_unit_details: getSchoolUnitDetails, get_school_units_by_status: getSchoolUnitsByStatus, search_school_units_by_name: searchSchoolUnitsByName, // Planned Education API search_adult_education: searchAdultEducation, get_adult_education_details: getAdultEducationDetails, filter_adult_education_by_distance: filterAdultEducationByDistance, filter_adult_education_by_pace: filterAdultEducationByPace, get_education_areas: getEducationAreas, get_directions: getDirections, // Diagnostics health_check: healthCheck, };
- Underlying API client method called by the tool handler to fetch education areas from the Planned Education API endpoint '/v3/support/geographical-areas'.async getEducationAreas(): Promise<ApiResponse<SupportDataResponse>> { return this.get<ApiResponse<SupportDataResponse>>('/v3/support/geographical-areas'); }
- src/http-server.ts:29-29 (helper)Import statement in the HTTP server that brings in the getEducationAreas handler for registration.import { getEducationAreas, getDirections } from './tools/planned-education/support-data.js';