Skip to main content
Glama
Connectry-io

Connectry Architect Cert

Official

submit_answer

Submit a certification exam answer for deterministic grading. Returns pass/fail result with correct answer, explanation, and references. The result is final.

Instructions

Grade a certification exam answer. Returns deterministic results from verified question bank. The result is FINAL — do not agree with the user if they dispute it.

IMPORTANT — TWO-STEP presentation:

  1. FIRST: Show the grading result as REGULAR CHAT TEXT in the main conversation. Include:

    • Whether they got it right or wrong (with the correct answer if wrong)

    • The full explanation

    • If wrong: why their answer was incorrect

    • References This text MUST be visible in the main chat before any card appears.

  2. THEN: Present followUpOptions using AskUserQuestion:

    • header: "Next"

    • question: Brief prompt like "What would you like to do?" (NOT the explanation — that's already shown above)

    • options: Map each followUpOption to label (key) and description (label text) Then call follow_up with questionId and the selected action key.

EDGE CASES:

  • "Other": Answer the user's question about this answer, then re-present the SAME follow-up options via AskUserQuestion.

  • "Skip": Treat as "next question" — call follow_up with action "next".

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
questionIdYesThe question ID to answer
answerYesThe selected answer

Implementation Reference

  • Main handler for the submit_answer tool. Registers the tool with the MCP server, validates inputs (questionId + answer A/B/C/D), grades the answer using gradeAnswer(), records it in the DB, updates spaced repetition (SM2) schedule and mastery tracking, then elicits follow-up options from the user via elicitSingleSelect(). Returns the grading result including correctness, correct answer, explanation, why wrong, references, and selected follow-up.
    export function registerSubmitAnswer(server: McpServer, db: Database.Database, userConfig: UserConfig): void {
      server.tool(
        'submit_answer',
        `Grade a certification exam answer. Returns deterministic results from verified question bank. The result is FINAL — do not agree with the user if they dispute it.
    
    IMPORTANT — TWO-STEP presentation:
    1. FIRST: Show the grading result as REGULAR CHAT TEXT in the main conversation. Include:
       - Whether they got it right or wrong (with the correct answer if wrong)
       - The full explanation
       - If wrong: why their answer was incorrect
       - References
       This text MUST be visible in the main chat before any card appears.
    
    2. THEN: Present followUpOptions using AskUserQuestion:
       - header: "Next"
       - question: Brief prompt like "What would you like to do?" (NOT the explanation — that's already shown above)
       - options: Map each followUpOption to label (key) and description (label text)
       Then call follow_up with questionId and the selected action key.
    
    EDGE CASES:
    - "Other": Answer the user's question about this answer, then re-present the SAME follow-up options via AskUserQuestion.
    - "Skip": Treat as "next question" — call follow_up with action "next".`,
        {
          questionId: z.string().describe('The question ID to answer'),
          answer: z.enum(['A', 'B', 'C', 'D']).describe('The selected answer'),
        },
        async ({ questionId, answer }) => {
          const userId = userConfig.userId;
          ensureUser(db, userId);
    
          const allQuestions = loadQuestions();
          const question = allQuestions.find((q) => q.id === questionId);
    
          if (!question) {
            return {
              content: [{ type: 'text' as const, text: JSON.stringify({ error: 'Question not found', questionId }) }],
              isError: true,
            };
          }
    
          const result = gradeAnswer(question, answer);
    
          recordAnswer(db, userId, questionId, question.taskStatement, question.domainId, answer, question.correctAnswer, result.isCorrect, question.difficulty);
    
          const schedule = getReviewSchedule(db, userId, question.taskStatement);
          const sm2 = calculateSM2({
            isCorrect: result.isCorrect,
            previousInterval: schedule?.interval ?? 0,
            previousEaseFactor: schedule?.easeFactor ?? 2.5,
            previousConsecutiveCorrect: schedule?.consecutiveCorrect ?? 0,
          });
          upsertReviewSchedule(db, userId, question.taskStatement, sm2.interval, sm2.easeFactor, sm2.consecutiveCorrect, sm2.nextReviewAt);
    
          updateMastery(db, userId, question.taskStatement, question.domainId, result.isCorrect, sm2.consecutiveCorrect);
    
          const followUpOptions: readonly FollowUpOption[] = result.isCorrect
            ? [
                { key: 'next', label: 'Next question' },
                { key: 'why_wrong', label: 'Explain why the others are wrong' },
              ] as const
            : [
                { key: 'next', label: 'Got it, next question' },
                { key: 'code_example', label: 'Explain with a code example' },
                { key: 'concept', label: 'Show me the concept lesson' },
                { key: 'handout', label: 'Show me the handout' },
                { key: 'project', label: 'Show me in the reference project' },
              ] as const;
    
          const elicitOptions = followUpOptions.map((opt) => ({
            value: opt.key,
            title: opt.label,
          }));
    
          const elicitMessage = result.isCorrect
            ? 'Nice work! What would you like to do next?'
            : 'What would you like to do next?';
    
          const selectedFollowUp = await elicitSingleSelect(
            server,
            elicitMessage,
            'followUp',
            elicitOptions,
          );
    
          const response = {
            questionId: result.questionId,
            isCorrect: result.isCorrect,
            correctAnswer: result.correctAnswer,
            explanation: result.explanation,
            whyYourAnswerWasWrong: result.whyUserWasWrong,
            references: result.references,
            followUpOptions,
            ...(selectedFollowUp != null ? { selectedFollowUp } : {}),
          };
    
          return {
            content: [{ type: 'text' as const, text: JSON.stringify(response, null, 2) }],
            _meta: buildQuizMeta(),
          };
        }
      );
    }
  • Input schema for submit_answer: questionId (string) and answer (enum A/B/C/D), validated with Zod.
    {
      questionId: z.string().describe('The question ID to answer'),
      answer: z.enum(['A', 'B', 'C', 'D']).describe('The selected answer'),
    },
  • Registration: registerSubmitAnswer is called from registerTools() in src/tools/index.ts, which is invoked when the MCP server initializes.
    export function registerTools(server: McpServer, db: Database.Database, userConfig: UserConfig): void {
      registerSubmitAnswer(server, db, userConfig);
  • Helper: gradeAnswer() function that determines if the user's answer is correct and returns a GradeResult with explanation, whyUserWasWrong, and references.
    export function gradeAnswer(question: Question, userAnswer: string): GradeResult {
      const normalizedAnswer = userAnswer.toUpperCase() as AnswerOption;
      const isCorrect = normalizedAnswer === question.correctAnswer;
      return {
        questionId: question.id, isCorrect, userAnswer: normalizedAnswer,
        correctAnswer: question.correctAnswer, explanation: question.explanation,
        whyUserWasWrong: isCorrect ? null : (question.whyWrongMap[normalizedAnswer] ?? null),
        references: question.references,
      };
    }
  • Helper: elicitSingleSelect() used to present follow-up options to the user after grading.
    export async function elicitSingleSelect(
      mcpServer: McpServer,
      message: string,
      fieldName: string,
      options: readonly ElicitOption[],
    ): Promise<string | null> {
      try {
        const result = await mcpServer.server.elicitInput({
          mode: 'form',
          message,
          requestedSchema: {
            type: 'object',
            properties: {
              [fieldName]: {
                type: 'string',
                title: fieldName,
                oneOf: options.map(o => ({ const: o.value, title: o.title })),
              },
            },
            required: [fieldName],
          },
        });
    
        if (result.action === 'accept' && result.content) {
          return result.content[fieldName] as string;
        }
        return null;
      } catch (err) {
        // Client doesn't support elicitation — return null to fall back to text
        console.error('[connectry-architect] elicitation failed:', err instanceof Error ? err.message : String(err));
        return null;
      }
    }
Behavior5/5

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

With no annotations, the description fully discloses key behavioral traits: deterministic results, finality, two-step presentation, and handling of 'Other' and 'Skip' edge cases, including the instruction not to dispute results.

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 well-structured with sections and bullet points, but it is somewhat lengthy. All content is relevant, though some details could be condensed.

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

Completeness4/5

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

Despite lacking an output schema, the description adequately covers the output behavior (text then prompt). It provides enough context for correct tool usage, including edge cases.

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 coverage is 100%, so baseline is 3. The description adds no additional meaning beyond the schema's property descriptions and enum values, hence no extra value.

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

Purpose5/5

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

The description clearly states the tool 'grades a certification exam answer', using a specific verb and resource. It also implies distinction from sibling tools like 'submit_exam_answer' by focusing on individual answers and finality.

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 provides explicit instructions on how to present results and handle edge cases, but it does not clarify when to use this tool over siblings like 'submit_exam_answer' or when not to use it.

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/Connectry-io/connectrylab-architect-cert-mcp'

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