Skip to main content
Glama

get_subject_and_course_codes

Retrieve all available subject and course codes from Swedish educational data to explore curriculum offerings, identify correct codes for searches, and build educational overviews.

Instructions

Hämta alla tillgängliga ämnes- och kurskoder.

ANVÄNDNINGSFALL:

  • Utforska hela kursutbudet

  • Hitta rätt kod för sökning

  • Bygga översikter

RETURNERAR: Komplett lista över alla koder med typ (subject/course).

OBS: Stor datamängd, kan ta tid att ladda.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The primary handler function for the 'get_subject_and_course_codes' tool. It calls the syllabus API, processes the response with counts for subjects and courses, and returns a formatted MCP content response or error.
    export async function getSubjectAndCourseCodes() {
      try {
        const codes = await syllabusApi.getSubjectAndCourseCodes();
    
        return {
          content: [
            {
              type: 'text' as const,
              text: JSON.stringify({
                codes: codes,
                total: codes.length,
                subjects: codes.filter(c => c.type === 'SUBJECT').length,
                courses: codes.filter(c => c.type === 'COURSE').length
              }, null, 2)
            }
          ]
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text' as const,
              text: `Fel vid hämtning av ämnes- och kurskoder: ${error instanceof Error ? error.message : String(error)}`
            }
          ],
          isError: true
        };
      }
  • Registration of the tool 'get_subject_and_course_codes' in the HTTP server's tools registry, mapping the snake_case name to the camelCase handler function.
    get_school_types: getSchoolTypes,
    get_types_of_syllabus: getTypesOfSyllabus,
    get_subject_and_course_codes: getSubjectAndCourseCodes,
    get_study_path_codes: getStudyPathCodes,
    get_api_info: getApiInfo,
  • Helper method in the Syllabus API client that fetches subject and course codes from Skolverket's valuestore endpoint with 24-hour caching.
    async getSubjectAndCourseCodes(): Promise<SubjectAndCourseCode[]> {
      const response = await this.getCached<{ codes: SubjectAndCourseCode[] }>(
        '/v1/valuestore/subjectandcoursecodes',
        undefined,
        86400000 // 24 timmar cache
      );
      return response.codes || [];
    }

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