Skip to content

feat(server): add utility functions for CallToolResult #73

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Apr 30, 2025

Conversation

Stream29
Copy link
Contributor

Motivation and Context

I add two function in types.util.kt : CallToolResult.Companion.ok and CallToolResult.Companion.error.

I found it being a boilerplate code when writing CallToolResult(listOf(TextContent(content))). So I think it's necessary to add a short hand for constructing CallToolResult.

My solution is : CallToolResult.ok(...) and CallToolResult.error(...).

I added these two functions with document.

How Has This Been Tested?

It's just a wrapper of the constructor of CallToolResult, so I think no test needed after viewing the code.

Breaking Changes

This is not a breaking change.

Types of changes

  • [+ ] New feature (non-breaking change which adds functionality)

CallToolResult.Companion.ok and CallToolResult.Companion.error
@Stream29
Copy link
Contributor Author

@Mr3zee Could you take a look at my PR? Merge it, close it, or tell me what to do.

Copy link
Contributor

@e5l e5l left a comment

Choose a reason for hiding this comment

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

hey @Stream29, thanks for the PR. LGTM.
Could you add tests and update API dump so I can merge?

@Stream29
Copy link
Contributor Author

OK. I'll be working on it quickly.

@Stream29 Stream29 requested a review from e5l April 26, 2025 12:54
@e5l e5l enabled auto-merge (squash) April 29, 2025 13:44
@e5l e5l disabled auto-merge April 30, 2025 04:32
@e5l e5l enabled auto-merge (squash) April 30, 2025 04:32
@e5l e5l merged commit 129731c into modelcontextprotocol:main Apr 30, 2025
1 check passed
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.

2 participants