Skip to content

Conversation

jacksteamdev
Copy link
Owner

@jacksteamdev jacksteamdev commented Jan 14, 2025

Problem

The MCP SDK was inconsistently handling boolean parameters, requiring custom type coercion in multiple places. Additionally, template arguments were required even when not needed, and frontmatter types were unnecessarily restrictive.

Solution

  • Added a generic coerceBooleanParams method to handle boolean parameters coming from the MCP SDK as "true"/"false" strings
  • Made template arguments optional and added proper null checks
  • Simplified frontmatter type to be a generic Record to support varying metadata
  • Enhanced error logging with explicit message and stack trace inclusion
  • Removed custom boolean handling code in favor of the new generic solution

Testing

  • Verify boolean parameters are correctly coerced across all API endpoints
  • Test template execution with and without arguments
  • Confirm frontmatter with custom fields is properly handled
  • Check error logging includes complete stack traces

Notes

This change improves type safety and reduces code duplication by centralizing boolean parameter handling. It also makes the API more flexible by allowing optional template arguments and arbitrary frontmatter fields.

@jacksteamdev jacksteamdev force-pushed the fix--coerce-fake-booleans-in-mcp-client-requests branch from 51e1bae to fda2622 Compare January 14, 2025 19:40
@jacksteamdev jacksteamdev merged commit 84c5a88 into main Jan 14, 2025
@jacksteamdev jacksteamdev deleted the fix--coerce-fake-booleans-in-mcp-client-requests branch January 14, 2025 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant