Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix for GitHub Issue #10: Missing "type": "text" field in MCP responses
Problem Description
All tools in the Databricks MCP server were returning output missing the required
"type": "text"field in their responses. This caused Pydantic validation errors when the output was parsed against theTextContentmodel, which requires both"type": "text"and"text"fields.Root Cause
The response objects returned from the tools included only a
"text"field but lacked the mandatory"type": "text"field, which is required by theTextContentmodel in the MCP Python SDK.Example of the problematic pattern:
Example of validation error:
Solution Implemented
1. Added a helper function
_format_response()2. Updated all tool return statements
Replaced all 76 instances of problematic return statements:
Files Modified
databricks_mcp/server/databricks_mcp_server.py_format_response()helper functionTools Fixed
All 38 tools in the server were updated, including:
Verification
"type": "text"and"text"fieldsImpact
This fix resolves the validation errors that were preventing all MCP tools from functioning correctly. Tools now return properly formatted responses that conform to the MCP TextContent model specification.