Skip to content

Conversation

@EugeneTheDev
Copy link
Collaborator

@EugeneTheDev EugeneTheDev commented Dec 4, 2025

This PR introduces breaking changes in Tool API

Currently argsSerializer, resultSerializer, name, description and descriptor are meant to be overriden to provide your own values. Since we can also generate descriptor automatically now, it introduces a discrepancy between property values and the actual state of things. It's described in KG-508. So current version makes for unstable and somewhat confusing API.

In this PR, I've moved these configurable tool properties to the constructors instead. This avoids confusion, since now the ways in which you can configure the tool are visible more explicitly - either provide your own descriptor, or opt for an automatic generation and only provide name and description. Updated API also looks a bit more concise and fluent, IMHO, since you have to write less override now. Compare these:

// Before
object DummyTool : SimpleTool<Unit>() {
    override val argsSerializer = Unit.serializer()

    override val name: String = "dummy"
    override val description: String = "Dummy tool for testing"

    override suspend fun doExecute(args: Unit): String = "Dummy result"
}

// After
object DummyTool : SimpleTool<Unit>(
    argsSerializer = Unit.serializer(),
    name = "dummy",
    description = "Dummy tool for testing"
) {
    override suspend fun execute(args: Unit): String = "Dummy result"
}

Also, another breaking change, as you have already seen from the example above, is doExecute removal. It is not needed anymore, since tools support primitive types now, so you can just use a regular execute

@EugeneTheDev EugeneTheDev force-pushed the eugenethedev/fix-tool branch from c1c2967 to 17f3530 Compare December 4, 2025 21:59
@EugeneTheDev EugeneTheDev marked this pull request as ready for review December 4, 2025 23:02
@github-actions
Copy link

github-actions bot commented Dec 4, 2025

Qodana for JVM

1168 new problems were found

Inspection name Severity Problems
Check Kotlin and Java source code coverage 🔶 Warning 1157
Missing KDoc for public API declaration 🔶 Warning 11
@@ Code coverage @@
+ 72% total lines covered
16835 lines analyzed, 12215 lines covered
# Calculated according to the filters of your coverage tool

☁️ View the detailed Qodana report

Contact Qodana team

Contact us at [email protected]

Copy link
Contributor

@kpavlov kpavlov left a comment

Choose a reason for hiding this comment

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

Hey @EugeneTheDev, could you please add a PR description and update the identity tool’s name and description before we merge?

Comment on lines +112 to +115
name = SubgraphWithTaskUtils.FINALIZE_SUBGRAPH_TOOL_NAME,
description = SubgraphWithTaskUtils.FINALIZE_SUBGRAPH_TOOL_DESCRIPTION
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it a copy from finalize tool?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It was like this before. This identityTool is internal and is used actually only as a finalize tool to provide the final result, hence the finalize tool name. Sounds like we can leave it as it is. Or do you want me to make name and description configurable (although there's no use for it currently). wdyt?

@kpavlov kpavlov self-requested a review December 10, 2025 13:48
@EugeneTheDev
Copy link
Collaborator Author

Updated description

@github-actions
Copy link

Qodana for JVM

1206 new problems were found

Inspection name Severity Problems
Check Kotlin and Java source code coverage 🔶 Warning 1186
Missing KDoc for public API declaration 🔶 Warning 20
@@ Code coverage @@
+ 72% total lines covered
17235 lines analyzed, 12530 lines covered
# Calculated according to the filters of your coverage tool

☁️ View the detailed Qodana report

Contact Qodana team

Contact us at [email protected]

@EugeneTheDev EugeneTheDev merged commit 2aef6c3 into develop Dec 15, 2025
12 checks passed
@EugeneTheDev EugeneTheDev deleted the eugenethedev/fix-tool branch December 15, 2025 14:01
EugeneTheDev added a commit that referenced this pull request Dec 15, 2025
vova-jb pushed a commit that referenced this pull request Jan 27, 2026
…e it more robust (#1226)

**This PR introduces breaking changes in Tool API**

Currently `argsSerializer`, `resultSerializer`, `name`, `description`
and `descriptor` are meant to be overriden to provide your own values.
Since we can also generate `descriptor` automatically now, it introduces
a discrepancy between property values and the actual state of things.
It's described in [KG-508](https://youtrack.jetbrains.com/issue/KG-508).
So current version makes for unstable and somewhat confusing API.

In this PR, I've moved these configurable tool properties to the
constructors instead. This avoids confusion, since now the ways in which
you can configure the tool are visible more explicitly - either provide
your own `descriptor`, or opt for an automatic generation and only
provide `name` and `description`. Updated API also looks a bit more
concise and fluent, IMHO, since you have to write less `override` now.
Compare these:
```kt
// Before
object DummyTool : SimpleTool<Unit>() {
    override val argsSerializer = Unit.serializer()

    override val name: String = "dummy"
    override val description: String = "Dummy tool for testing"

    override suspend fun doExecute(args: Unit): String = "Dummy result"
}

// After
object DummyTool : SimpleTool<Unit>(
    argsSerializer = Unit.serializer(),
    name = "dummy",
    description = "Dummy tool for testing"
) {
    override suspend fun execute(args: Unit): String = "Dummy result"
}
```

Also, another breaking change, as you have already seen from the example
above, is `doExecute` removal. It is not needed anymore, since tools
support primitive types now, so you can just use a regular `execute`
vova-jb pushed a commit that referenced this pull request Jan 27, 2026
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.

3 participants