Skip to content

Conversation

@melionel
Copy link

Description

Please add an informative description that covers that changes made by the pull request and link all relevant issues.

If an SDK is being regenerated based on a new API spec, a link to the pull request containing these API spec changes should be included above.

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

@github-actions github-actions bot added Community Contribution Community members are working on the issue customer-reported Issues that are reported by GitHub users external to the Azure organization. labels Jan 14, 2026
@github-actions
Copy link

Thank you for your contribution @melionel! We will review the pull request and get back to you soon.

tools = await self._foundry_tool_client.list_tools()
base = context.chat_options or ChatOptions()
base_tools = base.tools or []
context.chat_options.tools = base_tools + tools
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

chat_options may be None

:ivar Any value: The result value from the tool invocation.
"""
value: Any = Field(serialization_alias="toolResult")
value: Any = Field(validation_alias="toolResult", serialization_alias="toolResult")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can remove serialization_alias="toolResult" since we only do deserialize

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removing this will case the connected tool invocation result validation failure:
image

],
Discriminator(
lambda payload: "ErrorType" if isinstance(payload, dict) and "type" in payload else "ResultType"
lambda payload: "ErrorType" if isinstance(payload, dict) and
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in service code, only error related response has field 'type'

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's not true. even the success response contains the 'type' field

payload_text = response.text()
payload_json = json.loads(payload_text) if payload_text else {}
except AttributeError as e:
payload_bytes = response.body()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what scenario will trigger this exception?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just in case the response has no text()

async with response:
invoke_response = InvokeFoundryConnectedToolsResponse.model_validate(response.json())
try:
payload_text = response.text()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems we can move them to base operations if we need do the same thing on every response

@JC-386 JC-386 merged commit f158295 into Azure:jc/refactor-tools-api Jan 17, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Community Contribution Community members are working on the issue customer-reported Issues that are reported by GitHub users external to the Azure organization.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants