Skip to main content
Glama

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
NameRequiredDescriptionDefault
codeYes

Implementation Reference

  • 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")')
    };
  • 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,
  • 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';

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/isakskogstad/skolverket-syllabus-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server