Skip to main content
Glama
sifue

ZEN University Syllabus MCP Server

by sifue

get-a-subject-with-detail

Retrieve detailed course information from ZEN University's syllabus by specifying enrollment year and search keywords to find relevant subjects.

Instructions

Retrieve detailed a course information from the ZEN University syllabus. The numeric intended year of enrollment (enrollment_grade (optional)) and the freeword parameter (freeword) must be specified. The freeword parameter is intended for searching course names and similar keywords.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
enrollment_gradeNo year of enrollment (e.g. 1, 2, 3, 4)
freewordYesthe freeword search parameter (e.g. 'ITリテラシー')

Implementation Reference

  • The handler function for the 'get-a-subject-with-detail' tool. It takes enrollment_grade and freeword parameters, fetches matching subjects from the ZEN University syllabus API using fetchAllPages, filters and formats the data, and returns a text response with a list of subjects and detailed info for the first one.
    async ({ enrollment_grade, freeword }) => {
      try {
        const options: FetchOptions = {};
    
        if (enrollment_grade) {
          options.enrollment_grade = enrollment_grade.toString();
        }
    
        if (freeword) {
          options.freeword = freeword;
        }
    
        const apiResponse = await fetchAllPages(options);
        
        // 必要なフィールドのみを抽出
        const filteredSubjects = apiResponse.subjects.map(subject => ({
          code: subject.code,
          name: subject.name,
          description: subject.description,
          thumbnailUrl: subject.thumbnailUrl,
          openingYear: subject.openingYear,
          faculty: subject.faculty ? subject.faculty.map(f => ({
            id: f.id,
            name: f.name,
            reading: f.reading,
            isForeign: f.isForeign,
            title: f.title,
            expertise: f.expertise,
            avatarUrl: f.avatarUrl
          })) : [],
          metadata: {
            enrollmentGrade: subject.metadata.enrollmentGrade,
            teachingMethod: subject.metadata.teachingMethod,
            subjectRequirement: subject.metadata.subjectRequirement,
            evaluationSystem: subject.metadata.evaluationSystem,
            credit: subject.metadata.credit,
            quarters: subject.metadata.quarters,
            objective: subject.metadata.objective,
            specialNotes: subject.metadata.specialNotes,
            coursePlans: subject.metadata.coursePlans ? subject.metadata.coursePlans.map(plan => ({
              title: plan.title,
              description: plan.description,
              sections: plan.sections
            })) : []
          },
          subjectCategoryIds: subject.subjectCategoryIds || []
        }));
        
        // フィルタリングした結果を新しいレスポンスオブジェクトに設定
        const filteredResponse: ApiResponse = {
          totalCount: apiResponse.totalCount,
          pageSize: apiResponse.pageSize,
          page: apiResponse.page,
          totalPages: apiResponse.totalPages,
          relatedTags: apiResponse.relatedTags,
          subjects: filteredSubjects
        };
        
        // 科目名の一覧と最初の科目の詳細のみを表示するテキスト形式に変換
        const formattedText = formatSubjectsWithFirstDetailToText(filteredResponse);
        
        return {
          content: [
            {
              type: "text",
              text: formattedText,
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: `Error: ${error}`,
            },
          ],
        };
      }
    },
  • The input schema for the tool using Zod validation, defining optional enrollment_grade (1-4) and required freeword string.
    {
      enrollment_grade: z.number().min(1).max(4).describe(" year of enrollment (e.g. 1, 2, 3, 4)").optional(),
      freeword: z.string().describe("the freeword search parameter (e.g. 'ITリテラシー')"),
    },
  • src/index.ts:373-461 (registration)
    The registration of the 'get-a-subject-with-detail' tool on the MCP server, including name, description, schema, and handler.
    server.tool(
      "get-a-subject-with-detail",
      "Retrieve detailed a course information from the ZEN University syllabus. The numeric intended year of enrollment (enrollment_grade (optional)) and the freeword parameter (freeword) must be specified. The freeword parameter is intended for searching course names and similar keywords.",
      {
        enrollment_grade: z.number().min(1).max(4).describe(" year of enrollment (e.g. 1, 2, 3, 4)").optional(),
        freeword: z.string().describe("the freeword search parameter (e.g. 'ITリテラシー')"),
      },
    
      async ({ enrollment_grade, freeword }) => {
        try {
          const options: FetchOptions = {};
    
          if (enrollment_grade) {
            options.enrollment_grade = enrollment_grade.toString();
          }
    
          if (freeword) {
            options.freeword = freeword;
          }
    
          const apiResponse = await fetchAllPages(options);
          
          // 必要なフィールドのみを抽出
          const filteredSubjects = apiResponse.subjects.map(subject => ({
            code: subject.code,
            name: subject.name,
            description: subject.description,
            thumbnailUrl: subject.thumbnailUrl,
            openingYear: subject.openingYear,
            faculty: subject.faculty ? subject.faculty.map(f => ({
              id: f.id,
              name: f.name,
              reading: f.reading,
              isForeign: f.isForeign,
              title: f.title,
              expertise: f.expertise,
              avatarUrl: f.avatarUrl
            })) : [],
            metadata: {
              enrollmentGrade: subject.metadata.enrollmentGrade,
              teachingMethod: subject.metadata.teachingMethod,
              subjectRequirement: subject.metadata.subjectRequirement,
              evaluationSystem: subject.metadata.evaluationSystem,
              credit: subject.metadata.credit,
              quarters: subject.metadata.quarters,
              objective: subject.metadata.objective,
              specialNotes: subject.metadata.specialNotes,
              coursePlans: subject.metadata.coursePlans ? subject.metadata.coursePlans.map(plan => ({
                title: plan.title,
                description: plan.description,
                sections: plan.sections
              })) : []
            },
            subjectCategoryIds: subject.subjectCategoryIds || []
          }));
          
          // フィルタリングした結果を新しいレスポンスオブジェクトに設定
          const filteredResponse: ApiResponse = {
            totalCount: apiResponse.totalCount,
            pageSize: apiResponse.pageSize,
            page: apiResponse.page,
            totalPages: apiResponse.totalPages,
            relatedTags: apiResponse.relatedTags,
            subjects: filteredSubjects
          };
          
          // 科目名の一覧と最初の科目の詳細のみを表示するテキスト形式に変換
          const formattedText = formatSubjectsWithFirstDetailToText(filteredResponse);
          
          return {
            content: [
              {
                type: "text",
                text: formattedText,
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error: ${error}`,
              },
            ],
          };
        }
      },
    );
  • Helper function that fetches all pages of the syllabus API based on options (freeword, enrollment_grade) and merges all subjects into a single response.
    async function fetchAllPages(options?: FetchOptions) {
      // まず最初のページを取得
      const firstPageUrl = createUrl(0, options);
      const firstResponse = await fetch(firstPageUrl);
      if (!firstResponse.ok) {
        throw new Error(`APIリクエストに失敗しました: ${firstResponse.status} ${firstResponse.statusText}`);
      }
    
      const firstData = (await firstResponse.json()) as ApiResponse;
      const allSubjects = [...firstData.subjects];
      const { totalPages, totalCount, pageSize, relatedTags } = firstData;
    
      // 2ページ目以降を順次取得 (page=1 ~ totalPages-1)
      for (let page = 1; page < totalPages; page++) {
        const url = createUrl(page, options);
        const response = await fetch(url);
    
        if (!response.ok) {
          throw new Error(`APIリクエストに失敗しました: ${response.status} ${response.statusText}`);
        }
    
        const data = (await response.json()) as ApiResponse;
        allSubjects.push(...data.subjects);
      }
    
      // 単一のオブジェクトとしてまとめる
      const mergedData = {
        totalCount,
        pageSize,
        page: 0, // 全ページのデータを結合した結果なので、page=0 とする
        totalPages,
        relatedTags,
        subjects: allSubjects,
      };
    
      return mergedData;
    }
  • Helper function that formats the API response into text: list of all matching subjects and detailed markdown for the first one.
    function formatSubjectsWithFirstDetailToText(apiResponse: ApiResponse): string {
      if (apiResponse.subjects.length === 0) {
        return `検索結果: 0件の科目が見つかりました\n\n`;
      }
    
      let text = `検索結果: ${apiResponse.totalCount}件の科目が見つかりました\n\n`;
      
      // 科目名の一覧を表示
      text += `## 科目一覧\n`;
      apiResponse.subjects.forEach((subject, index) => {
        text += `${index + 1}. ${subject.name} (${subject.code})\n`;
      });
      
      text += `\n${'='.repeat(50)}\n\n`;
      
      // 最初の科目の詳細を表示
      text += `## 最初の科目の詳細\n\n`;
      text += formatSubjectToText(apiResponse.subjects[0]);
      
      // 他の科目の詳細を見るには再度問い合わせるように促すメッセージ
      if (apiResponse.subjects.length > 1) {
        text += `\n${'='.repeat(50)}\n\n`;
        text += `※ 他の科目の詳細を見るには、科目名を指定して再度問い合わせてください。\n`;
      }
      
      return text;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions that parameters 'must be specified' and describes the freeword's purpose, but lacks details on permissions, rate limits, error handling, or what 'detailed information' entails. This is a significant gap for a tool with no annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise with three sentences that efficiently cover purpose and parameter usage. It's front-loaded with the main action and avoids unnecessary details, though it could be slightly more structured by separating purpose from parameter guidelines.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (2 parameters, no output schema, no annotations), the description is adequate but incomplete. It explains the purpose and parameters but lacks behavioral context and output details, leaving gaps in understanding how to use it effectively beyond basic parameter input.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents both parameters thoroughly. The description adds some context by explaining that the freeword is for 'searching course names and similar keywords', but this doesn't significantly enhance the schema's details. Baseline 3 is appropriate as the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Retrieve detailed course information') and resource ('from the ZEN University syllabus'), making the purpose evident. However, it doesn't explicitly differentiate from the sibling tool 'get-list-of-all-subjects', which likely retrieves a broader list without detailed information or filtering.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage by specifying that parameters 'must be specified' for retrieving detailed information, suggesting this tool is for targeted searches rather than general listing. However, it doesn't explicitly state when to use this vs. the sibling tool or provide clear alternatives or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/sifue/zen-syllabus-mcp'

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