A starter/solution module demonstrating OpenAI chat completion integration with TypeScript, including message validation, configuration management, and token usage tracking.
Single tool 'runChatCompletion' has a well-structured input schema with proper types and descriptions for messages and options. However, the tool lacks critical production-grade patterns: no output schema documentation, no error handling guidance, no idempotency markers, and no security/permission declarations. The description is adequate (67 chars) but generic. Parameters are typed but lack constraints (e.g., temperature range, model enum). No pagination, no recovery guidance for API failures. This is a basic wrapper around OpenAI with minimal agent-optimization.
Runs a chat completion via the OpenAI client wrapper.
No output schema documented. LLMs cannot plan downstream operations or extract fields from ChatCompletionResult (content, totalTokens). Agents must infer structure from trial-and-error.
No error handling guidance. Tool throws generic 'Messages array cannot be empty' but provides no recovery path. API failures (timeout, rate limit, auth) return raw OpenAI errors with no actionable next steps for the LLM.
Parameters lack constraints. 'temperature' has no min/max bounds (should be 0 - 2 for OpenAI). 'model' accepts any string instead of an enum of supported models. LLMs will pass invalid values.
No idempotency or destructive-operation markers. Tool modifies external state (calls OpenAI API, incurs costs) but lacks idempotentHint or destructiveHint annotations. Agents cannot reason about retry safety.
| Scored | Grade | Overall | Spec posture | Rubric |
|---|---|---|---|---|
| 2026-09-23 | F | 41 | 2026-07-28+ | v2 |
API key exposed via environment variable without server-side injection pattern. If this MCP server is deployed, LLM_API_KEY could leak into logs or traces. Should use vault or secure secret store.