Skip to main content
Glama

get_school_units_by_status

Filter Swedish school units by operational status to find active, discontinued, or dormant educational institutions for analysis and reporting.

Instructions

Filtrera skolenheter efter status.

ANVÄNDNINGSFALL:

  • Hitta aktiva skolor

  • Lista nedlagda skolor

  • Spåra vilande enheter

  • Statistik och analys

RETURNERAR: Skolenheter med angiven status.

STATUS: AKTIV, UPPHORT (nedlagd), VILANDE.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
statusYes
limitNo

Implementation Reference

  • The main tool handler function that fetches school units by status from the API client, applies optional limit, formats JSON response with metadata, and handles errors.
    export async function getSchoolUnitsByStatus(params: {
      status: 'AKTIV' | 'UPPHORT' | 'VILANDE';
      limit?: number;
    }) {
      try {
        const units = await schoolUnitsApi.getSchoolUnitsByStatus(params.status);
    
        // Begränsa antal resultat
        const limitedUnits = params.limit ? units.slice(0, params.limit) : units.slice(0, 50);
    
        return {
          content: [
            {
              type: 'text' as const,
              text: JSON.stringify({
                status: params.status,
                totalFound: units.length,
                showing: limitedUnits.length,
                schoolUnits: limitedUnits
              }, null, 2)
            }
          ]
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text' as const,
              text: `Fel vid hämtning av skolenheter efter status: ${error instanceof Error ? error.message : String(error)}`
            }
          ],
          isError: true
        };
      }
    }
  • Zod schema for input validation: required status enum and optional limit with default 50.
    export const getSchoolUnitsByStatusSchema = {
      status: z.enum(['AKTIV', 'UPPHORT', 'VILANDE']).describe('Status att filtrera på'),
      limit: z.number().optional().default(50).describe('Maximalt antal resultat att returnera')
    };
  • Tool registration in the HTTP server's tools registry, mapping 'get_school_units_by_status' to the handler function.
    get_school_units_by_status: getSchoolUnitsByStatus,
  • API client helper method that retrieves school units filtered by status using client-side search.
    async getSchoolUnitsByStatus(status: 'AKTIV' | 'UPPHORT' | 'VILANDE' | 'PLANERAD'): Promise<any[]> {
      return this.searchSchoolUnits({ status });
    }

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