MCPServer: content-block returns are unstructured, prompt messages take Image/Audio (#3320)

This commit is contained in:
Max 2026-08-17 14:12:31 +01:00 • committed by GitHub
commit fb443cc4b2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -505,3 +505,18 @@ async def test_create_resource_passes_input_required_result_through_unchanged():
template = ResourceTemplate.from_function(fn=ask, uri_template="ask://{topic}")
result = await template.create_resource("ask://databases", {"topic": "databases"}, Context())
assert result is sentinel
class _Chart:
"""A plain class pydantic cannot build a schema for."""
def test_template_return_annotation_is_not_run_through_tool_output_schema_derivation() -> None:
"""SDK-defined: a resource template only needs its argument model, so an unschematizable return
annotation registers (it used to raise from the tool structured-output machinery)."""
def charts(year: str) -> list[_Chart]:
raise NotImplementedError
template = ResourceTemplate.from_function(charts, uri_template="charts://{year}")
assert template.uri_template == "charts://{year}"