Title: Midterm Exam
Course: AIINFRA 300: Agentic AI & the Model Context Protocol (MCP) > Section: Week 08 — Code-First Agent Frameworks II: CrewAI and OpenAI Agents SDK

📝 Midterm Exam (100 pts)

Instructor note: the answer key below is hidden from students in the published Canvas quiz.

Part A — Applied Scenario (40 pts)

Your team supports a mid-size logistics company that wants an internal tool: employees type a natural-language question about shipment status ("where is order #48213?") and get back a synthesized answer that may require calling an internal REST API, checking a vector store of policy documents, and possibly summarizing a long PDF manifest. The company already has a container platform and cloud deployment pipeline from earlier coursework, and wants the system exposed as a standard, reusable interface so it isn't locked into one particular agent framework or chat client. Using what you've learned across Weeks 1–7 (REST APIs, containers, cloud deployment, prompt design, tool-calling fundamentals, and MCP), describe:

1. How you would expose the shipment-status API, the policy vector store, and the PDF-summarization capability so that any MCP-compatible client (not just one framework) could use them
2. How you would containerize and deploy this MCP server so it can be reached reliably in production
3. What a client-side agent loop calling this MCP server would need to do at a high level (discover tools, call a tool, handle the result)

→ A strong answer: (1) Wrap each capability (shipment lookup, policy search, PDF summarize) as an MCP tool exposed by a single MCP server, so the server is the reusable interface — any MCP client (Claude Desktop, an agent framework, a custom app) can discover and call these tools without custom integration code per client. (2) Containerize the MCP server (Docker image, standard REST/stdio or HTTP transport for MCP), push to a registry, and deploy it on the team's existing container platform (e.g., a managed container service) behind a stable endpoint with health checks and logging, following the deployment practices from earlier weeks. (3) A client-side agent loop would: connect to the MCP server and call its tool-discovery/list endpoint, select the relevant tool(s) based on the user's natural-language request (possibly via an LLM function-calling step), invoke the tool with structured arguments, and pass the tool's result back into the model to produce a final synthesized answer for the employee.

Part B — Weeks 1–7 Review (60 pts, 5 pts each)

1. (MC) What does MCP primarily standardize? a) model weights b) the interface between AI applications and external tools/data sources c) GPU scheduling d) container orchestration

→ b

1. (TF) In a typical agent loop, the LLM directly executes tool code itself rather than requesting that the surrounding application execute it.

→ False — the LLM requests a tool call; the application/runtime executes it and returns the result.

1. (Short) Name two things a well-designed REST API resource naming scheme should support that make it easier for an agent to use reliably.

→ Predictable, consistent resource paths/verbs and clear, self-describing responses (e.g., consistent status codes and JSON shapes) — accept any reasonable pair such as versioning and idempotency.

1. (MC) Why containerize a tool server rather than running it as a bare script on a host? a) it's required by MCP b) reproducible environment, isolation, and portability across deployment targets c) it makes the code run faster d) it removes the need for authentication

→ b

1. (TF) Prompt engineering techniques like few-shot examples and explicit output-format instructions can materially reduce malformed tool-call arguments from an LLM.

→ True

1. (Short) What is the core difference between a "tool" and a "resource" in MCP's vocabulary?

→ A tool is an action/function the client can invoke (with side effects or computation); a resource is data/content the client can read (context to load), not something you "call" to perform an action.

1. (MC) In a cloud deployment pipeline, what is the primary purpose of a health check endpoint? a) to authenticate users b) to let the orchestrator detect and restart unhealthy instances c) to log all requests d) to encrypt traffic

→ b

1. (TF) An MCP client can only connect to one MCP server at a time.

→ False — a single client can connect to multiple MCP servers simultaneously, aggregating their tools/resources.

1. (Short) List two elements of a well-designed system prompt for an agent expected to use tools carefully.

→ Clear description of available tools/when to use them, and explicit constraints/guardrails on behavior (e.g., when to ask for clarification, output format expectations). Accept reasonable equivalents.

1. (MC) Which best describes "grounding" in the context of agents that call external data sources? a) reducing model temperature to zero b) anchoring the model's output in retrieved, verifiable external data rather than parametric memory alone c) running the model on a single GPU d) caching API responses

→ b

1. (TF) Statelessness in a REST API means the server retains no client session context between requests, so each request must carry all the information needed to process it.

→ True

1. (Short) Name one concrete risk of giving an agent a tool with broad, unscoped permissions (e.g., a database tool with full read/write access) and one mitigation.

→ Risk: the agent could take destructive or unintended actions (e.g., deleting/modifying data it shouldn't) due to a misinterpreted instruction or prompt injection. Mitigation: scope the tool's credentials/permissions to the minimum needed (least privilege), or require human confirmation for destructive operations.