Skip to content

Improve MCP tool error reporting#205

Open
mxstbr wants to merge 1 commit intomasterfrom
codex/enhance-error-messages-for-validation
Open

Improve MCP tool error reporting#205
mxstbr wants to merge 1 commit intomasterfrom
codex/enhance-error-messages-for-validation

Conversation

@mxstbr
Copy link
Owner

@mxstbr mxstbr commented Jan 11, 2026

Motivation

  • Provide consistent, developer-friendly error responses for MCP tools so callers receive detailed validation and debugging context.
  • Surface Zod validation issues, input payloads, and stack traces in the tool response so automated clients can react or surface helpful diagnostics.
  • Reduce time-to-debug for failures across calendar, chores, finance, and telegram MCP tools by wrapping handlers with a common error formatter.

Description

  • Add app/lib/mcp/tool-errors.ts implementing buildToolErrorResponse and withToolErrorHandling to format validation issues and include input context and stack traces.
  • Wrap MCP tool handlers in app/lib/calendar.ts, app/lib/chores.ts, app/lib/finance.ts, and app/lib/telegram.ts with withToolErrorHandling so failures return structured error payloads instead of raw exceptions.
  • Tighten input validation and messages by adding clearer Zod schemas (e.g. isoDateSchema messages, message min length) and improve thrown error text for calendar/finance operations.
  • No UI changes were made; changes are limited to MCP tool registration and error handling infrastructure.

Testing

  • Ran TypeScript check with pnpm tsc --noEmit which completed successfully.
  • Ran full build with pnpm build, which failed due to Next.js failing to fetch Google Fonts (Inter) from Google Fonts because of TLS/network restrictions, unrelated to these code changes.
  • Prettier formatting was applied as part of the commit hooks (auto-format step completed successfully).

Codex Task

@vercel
Copy link

vercel bot commented Jan 11, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
mxstbr.com Ready Ready Preview, Comment Jan 11, 2026 5:29pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant