search_adult_education
Search and filter Swedish adult education programs including vocational training, Swedish for immigrants, and municipal adult education by location, study pace, and course type.
Instructions
Sök vuxenutbildningar med omfattande filter.
ANVÄNDNINGSFALL:
Hitta YH-utbildningar (Yrkeshögskola)
Sök SFI-kurser (Svenska för invandrare)
Hitta Komvux-kurser
Filtrera efter stad, distans, studietakt
Planera vidareutbildning
RETURNERAR: Utbildningstillfällen med:
Titel och anordnare
Plats och kommun
Distans/campus
Starttider
Studietakt och omfattning
FILTER:
searchTerm: Sökord (t.ex. "programmering")
town: Stad (t.ex. "Stockholm")
typeOfSchool: "yh", "sfi", "komvuxgycourses"
distance: "true"/"false"
paceOfStudy: "100" (heltid), "50" (halvtid)
EXEMPEL: Hitta IT-utbildningar i Stockholm som är på heltid.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| searchTerm | No | ||
| town | No | ||
| county | No | ||
| municipality | No | ||
| typeOfSchool | No | ||
| distance | No | ||
| paceOfStudy | No | ||
| semesterStartFrom | No | ||
| page | No | ||
| size | No |
Implementation Reference
- The main asynchronous handler function that executes the tool logic: calls the plannedEducationApi.searchAdultEducation, processes the response, and returns formatted MCP content or error.export async function searchAdultEducation(params: { searchTerm?: string; town?: string; county?: string; municipality?: string; typeOfSchool?: string; distance?: 'true' | 'false'; paceOfStudy?: string; semesterStartFrom?: string; page?: number; size?: number; }) { try { const response = await plannedEducationApi.searchAdultEducation(params); if (response.status !== 'OK') { throw new Error(response.message || 'Okänt fel från API'); } const events = response.body._embedded.listedAdultEducationEvents; return { content: [ { type: 'text' as const, text: JSON.stringify({ totalResults: response.body.page?.totalElements || events.length, currentPage: response.body.page?.number || 0, totalPages: response.body.page?.totalPages || 1, showing: events.length, educationEvents: events.map(event => ({ id: event.educationEventId, title: event.titleSv, provider: event.providerName, municipality: event.municipality, county: event.county, town: event.town, typeOfSchool: event.typeOfSchool, distance: event.distance, paceOfStudy: event.paceOfStudy, semesterStart: event.semesterStartFrom, credits: event.credits })) }, null, 2) } ] }; } catch (error) { return { content: [ { type: 'text' as const, text: `Fel vid sökning av vuxenutbildningar: ${error instanceof Error ? error.message : String(error)}` } ], isError: true }; } }
- Zod schema defining the input parameters and descriptions for the search_adult_education tool.export const searchAdultEducationSchema = { searchTerm: z.string().optional().describe('Sökterm för utbildningar'), town: z.string().optional().describe('Stad/Studieort (t.ex. "Stockholm", "Göteborg")'), county: z.string().optional().describe('Län'), municipality: z.string().optional().describe('Kommun'), typeOfSchool: z.string().optional().describe('Utbildningsform (t.ex. "yh" för Yrkeshögskola, "sfi" för SFI, "komvuxgycourses" för Komvux)'), distance: z.enum(['true', 'false']).optional().describe('Distansutbildning (true/false)'), paceOfStudy: z.string().optional().describe('Studietakt (t.ex. "100", "50", "25" eller intervall "50-100")'), semesterStartFrom: z.string().optional().describe('Terminstart från datum (format: YYYY-MM-DD)'), page: z.number().optional().default(0).describe('Sidnummer (0-index)'), size: z.number().optional().default(20).describe('Antal resultat per sida (max 100)') };
- src/http-server.ts:78-78 (registration)Registration of the tool in the HTTP server's tools registry, mapping 'search_adult_education' to the searchAdultEducation handler function.search_adult_education: searchAdultEducation,