Skip to content

CallToolResult type missing member structuredContent #810

Closed
@stevemadere

Description

@stevemadere

Describe the bug

When a tool call is made to any tool with a defined outputSchema, the server absolutely blows up if the function implementing the tool call does not include structuredContent.

This structuredContent is included in the data.result of the server's response.

On client side, it definitely gets parsed and included in the CallToolResult object returned by session.call_tool().

All great so far.

However, the definition of CallToolResult class does not allow for a member named structuredContent.

(it also does not allow for a member named structured_content so that's not the issue).

To Reproduce
Steps to reproduce the behavior:

  1. Implement a tool "get_structure" with an outputSchema using the ModelContentProtocol typescript SDK.
  2. Call that tool from the python SDK:
    python result:CallToolResult = await session.call_tool(name="get_structure",arguments={}) print(f"result.structuredContent = {result.structuredContent}")
  3. Notice that the print succeeds
  4. Notice that pyright complains that Attribute "structuredContent" is unknown

Expected behavior
There should be an optional member called structuredContent in the declaration of CallToolResult:

structuredContent: dict[str, Any] | list[Any] | str | int | float | bool | None = None

Screenshots

Image

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions