get_school_unit_details
Retrieve detailed information about specific Swedish schools using their official school unit code to verify status, address, and complete school data.
Instructions
Hämta detaljer om en specifik skolenhet.
ANVÄNDNINGSFALL:
Se skolans fullständiga information
Kontrollera skolstatus
Verifiera skolenhetskod
RETURNERAR: Komplett skolenhetsinfo inkl. namn, adress, status.
EXEMPEL: Använd skolenhetskod (8 siffror).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes |
Implementation Reference
- src/tools/school-units/search.ts:69-106 (handler)The main handler function for the 'get_school_unit_details' tool. It takes a school unit code, fetches the details from the schoolUnitsApi, and returns a formatted JSON response or error message.export async function getSchoolUnitDetails(params: { code: string; }) { try { const unit = await schoolUnitsApi.getSchoolUnit(params.code); if (!unit) { return { content: [ { type: 'text' as const, text: `Ingen skolenhet hittades med kod: ${params.code}` } ], isError: true }; } return { content: [ { type: 'text' as const, text: JSON.stringify(unit, null, 2) } ] }; } catch (error) { return { content: [ { type: 'text' as const, text: `Fel vid hämtning av skolenhet: ${error instanceof Error ? error.message : String(error)}` } ], isError: true }; } }
- Zod schema defining the input parameters for the getSchoolUnitDetails tool: requires a 'code' string parameter.export const getSchoolUnitDetailsSchema = { code: z.string().describe('Skolenhetskod (t.ex. "29824923")') };
- src/http-server.ts:72-75 (registration)Registration of the 'get_school_unit_details' tool (as getSchoolUnitDetails) in the HTTP server's tools registry, alongside other school units tools.search_school_units: searchSchoolUnits, get_school_unit_details: getSchoolUnitDetails, get_school_units_by_status: getSchoolUnitsByStatus, search_school_units_by_name: searchSchoolUnitsByName,
- src/http-server.ts:27-27 (registration)Import statement in http-server.ts that brings in the getSchoolUnitDetails handler from the tools module.import { searchSchoolUnits, getSchoolUnitDetails, getSchoolUnitsByStatus, searchSchoolUnitsByName } from './tools/school-units/search.js';