feat(mcp): add title field to tool call chain for human-readable display#1914
Open
amyaxy wants to merge 3 commits into
Open
feat(mcp): add title field to tool call chain for human-readable display#1914amyaxy wants to merge 3 commits into
amyaxy wants to merge 3 commits into
Conversation
…play
Add an optional `title` field throughout the tool invocation pipeline,
providing a human-readable label alongside the machine-oriented `name`.
When no title is defined, consumers should fall back to `name` for display.
Feature changes:
- AgentTool: add default getTitle() returning getName()
- ToolBase / ToolSchema / SchemaOnlyTool / McpTool: support title in builder & getter
- ToolUseBlock / ToolResultBlock: add title field, withTitle(), withIdAndNameAndTitle()
- Event classes (ToolCallStart/End, ToolResultStart/End): add toolCallTitle
- ToolUtils: new resolveToolTitle() to look up title from Toolkit
- LegacyHookDispatcher / ReActAgent: resolve and set title on ToolUseBlock
- ToolResultMessageBuilder: propagate title from originalCall
- ToolSchemaProvider: pass tool.getTitle() when building schema
- AsyncToolMiddleware / PlanModeMiddleware: pass title through events
Test changes:
- NEW: ToolUtilsTest, ToolSchemaTest, ToolResultBlockTest,
ToolResultMessageBuilderTest (~36 test cases)
- EXTEND: ToolUseBlockTest, ToolBaseTest, SchemaOnlyToolTest,
AsyncToolMiddlewareTest (~14 additional test cases)
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
Contributor
|
Really thorough work threading the |
If not provided, the name should be used for display.
Contributor
Author
|
@chickenlj 辛苦抽空帮忙看下这个PR,谢谢 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Add an optional
titlefield throughout the tool invocation pipeline, providing a human-readable label alongside the machine-orientedname. When no title is defined, consumers should fall back tonamefor display.Feature changes:
Test changes:
AgentScope-Java Version
2.0.0-SNAPSHOT
Description
close #1590
Checklist
Please check the following items before code is ready to be reviewed.
mvn spotless:applymvn test)