Skip to content

Conversation

@jclyne
Copy link
Contributor

@jclyne jclyne commented Oct 23, 2025

Motivation and Context

The recently released openAI Apps SDK adds a '_meta' field on the Tool Descriptor. This would be in addition to it being available on Messages. It remains optional and defaults to an empty json object, following existing conventions.

How Has This Been Tested?

Unit tests for serialization added

Breaking Changes

N/A

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

https://developers.openai.com/apps-sdk
https://developers.openai.com/apps-sdk/reference/#_meta-fields-the-client-provides

Copilot AI review requested due to automatic review settings October 23, 2025 19:28
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds an optional _meta field to the Tool class to align with the OpenAI Apps SDK specification, which includes metadata fields on Tool descriptors. The change maintains backward compatibility by defaulting to an empty JSON object.

  • Adds _meta field to Tool data class by implementing the WithMeta interface
  • Updates Server.addTool() method to accept an optional _meta parameter
  • Adds comprehensive serialization tests for the new field

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types.kt Adds _meta field to Tool class and implements WithMeta interface
kotlin-sdk-server/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/server/Server.kt Updates addTool() method to accept optional _meta parameter
kotlin-sdk-core/src/commonTest/kotlin/io/modelcontextprotocol/kotlin/sdk/ToolSerializationTest.kt Adds test coverage for _meta field serialization

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

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.

Thank you, Jeff

kpavlov
kpavlov previously approved these changes Oct 23, 2025
@jclyne jclyne requested a review from kpavlov October 23, 2025 21:47
andrewjenkins added a commit to cashapp/misk that referenced this pull request Oct 23, 2025
Adds support for tool descriptor metadata to misk-mcp. This is required by then OpenAI Apps SDK: https://developers.openai.com/apps-sdk/reference

This is a temporary solution until modelcontextprotocol/kotlin-sdk#339 can be pulled in.
kpavlov
kpavlov previously approved these changes Oct 24, 2025
@jclyne
Copy link
Contributor Author

jclyne commented Oct 24, 2025

Thank you, Jeff

My pleasure @kpavlov, looking forward to this merge

@kpavlov kpavlov requested a review from devcrocod October 25, 2025 08:43
@maeryo
Copy link
Contributor

maeryo commented Oct 26, 2025

#289
Please refer to the recently merged PR.

@jclyne
Copy link
Contributor Author

jclyne commented Oct 28, 2025

ping @kpavlov and @devcrocod , would love to get this merged

# Conflicts:
#	kotlin-sdk-server/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/server/Server.kt
Copy link
Contributor

@devcrocod devcrocod left a comment

Choose a reason for hiding this comment

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

I have some concerns about adding a builder in this PR

Comment on lines 1265 to 1289
public class Builder {
public var name: String? = null
public var title: String? = null
public var description: String? = null
public var inputSchema: Input = Input()
public var outputSchema: Output? = null
public var annotations: ToolAnnotations? = null

@Suppress("PropertyName")
public var _meta: JsonObject = EmptyJsonObject

public fun build(): Tool = Tool(
name = requireNotNull(name) { "Tool name is required" },
title = title,
description = description,
inputSchema = inputSchema,
outputSchema = outputSchema,
annotations = annotations,
_meta = _meta,
)
}

public companion object {
public fun build(builder: Builder.() -> Unit): Tool = Builder().apply(builder).build()
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think adding a builder in this PR feels a bit out of place compared to the rest of the API

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, that was a PR suggestion from @kpavlov . I can revert the builder in order to get the too descriptor _meta field merged. Please advise @devcrocod

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@devcrocod I went ahead and removed the builder. If its still desired, it can be, more appropriately, in a separate PR.

@jclyne jclyne requested a review from devcrocod October 31, 2025 16:52
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.

👍🏻

@kpavlov kpavlov merged commit e4bd866 into modelcontextprotocol:main Nov 4, 2025
3 checks passed
@jclyne jclyne deleted the jclyne.10-23-adds_optional__meta_field_to_tool branch November 4, 2025 20:31
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.

4 participants