Skip to content

Move prompts trait to use smithy.ai namespace andsmithy-ai-traits package for easier upstreaming. #829

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 1 commit into from
Jul 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/mcp-server/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ dependencies {
val smithyJavaVersion: String by project

smithyBuild("software.amazon.smithy.java:plugins:$smithyJavaVersion")
implementation("software.amazon.smithy.java:mcp-traits:$smithyJavaVersion")
implementation("software.amazon.smithy.java:smithy-ai-traits:$smithyJavaVersion")
implementation("software.amazon.smithy.java:mcp-server:$smithyJavaVersion")
implementation("software.amazon.smithy.java:server-proxy:$smithyJavaVersion")
implementation("software.amazon.smithy.java:server-netty:$smithyJavaVersion")
Expand Down
2 changes: 1 addition & 1 deletion examples/mcp-server/smithy-build.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"service": "smithy.example.mcp#EmployeeService",
"namespace": "software.amazon.smithy.java.example.server.mcp",
"headerFile": "license.txt",
"runtimeTraits": ["smithy.api#documentation", "smithy.api#examples", "amazon.smithy.llm#prompts" ]
"runtimeTraits": ["smithy.api#documentation", "smithy.api#examples", "smithy.ai#prompts" ]
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ $version: "2"
namespace smithy.example.mcp

use aws.protocols#restJson1
use amazon.smithy.llm#prompts
use smithy.ai#prompts

@restJson1
@prompts({
Expand Down
2 changes: 1 addition & 1 deletion examples/mcp-traits-example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ service UserService {
```smithy
namespace com.example

use amazon.smithy.llm#prompts
use smithy.ai#prompts

@prompts({
search_users: {
Expand Down
3 changes: 1 addition & 2 deletions examples/mcp-traits-example/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ dependencies {
val smithyVersion: String by project

// Include the mcp-traits module for the @prompts trait
smithyBuild(project(":mcp:mcp-traits"))
implementation(project(":mcp:mcp-traits"))
implementation(project(":smithy-ai-traits"))

// Standard Smithy dependencies
smithyBuild("software.amazon.smithy.java:plugins:$smithyJavaVersion")
Expand Down
2 changes: 1 addition & 1 deletion examples/mcp-traits-example/model/main.smithy
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace com.example

use amazon.smithy.llm#prompts
use smithy.ai#prompts

@prompts({
search_users: { description: "Search for users in the system by various criteria", template: "Search for users where {{searchCriteria}}. Use pagination with limit={{limit}} if many results expected.", arguments: SearchUsersInput, preferWhen: "User wants to find specific users or browse user lists" }
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[versions]
junit5 = "5.13.4"
hamcrest = "3.0"
smithy = "1.60.3"
smithy = "1.61.0"
jmh = "0.7.3"
test-logger-plugin = "4.0.0"
spotbugs = "6.0.22"
Expand Down
2 changes: 1 addition & 1 deletion mcp/mcp-server/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ dependencies {
implementation(project(":codecs:json-codec", configuration = "shadow"))
implementation(project(":mcp:mcp-schemas"))
implementation(project(":mcp:mcp-bundle-api"))
implementation(project(":mcp:mcp-traits"))
implementation(project(":smithy-ai-traits"))
testRuntimeOnly(libs.smithy.aws.traits)
testRuntimeOnly(project(":aws:client:aws-client-awsjson"))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ private void writeNotification(String method, Document params) {

namespace smithy.test

use amazon.smithy.llm#prompts
use smithy.ai#prompts

/// A TestService
@aws.protocols#awsJson1_0
Expand Down Expand Up @@ -752,7 +752,7 @@ private void writeNotification(String method, Document params) {

namespace smithy.test.args

use amazon.smithy.llm#prompts
use smithy.ai#prompts
use aws.protocols#awsJson1_0

@awsJson1_0
Expand Down Expand Up @@ -780,7 +780,7 @@ private void writeNotification(String method, Document params) {

namespace smithy.test.edge

use amazon.smithy.llm#prompts
use smithy.ai#prompts
use aws.protocols#awsJson1_0

@awsJson1_0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace com.example

use amazon.smithy.llm#prompts
use smithy.ai#prompts

@prompts({
test_prompt: {
Expand Down
4 changes: 3 additions & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ pluginManagement {

rootProject.name = "smithy-java"

// AI
include(":smithy-ai-traits")

// Common modules
include(":context")
include(":core")
Expand Down Expand Up @@ -105,7 +108,6 @@ include(":mcp:mcp-server")
include(":mcp:mcp-cli")
include(":mcp:mcp-cli-api")
include(":mcp:mcp-bundle-api")
include(":mcp:mcp-traits")

include(":model-bundle")
include(":model-bundle:model-bundle-api")
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ plugins {
alias(libs.plugins.smithy.gradle.jar)
}

description = "MCP Traits"
description = "Smithy AI Traits"

extra["displayName"] = "Smithy :: Java :: MCP Traits"
extra["moduleName"] = "software.amazon.smithy.java.mcp.traits"
extra["displayName"] = "Smithy :: Java :: AI Traits"
extra["moduleName"] = "software.amazon.smithy.ai.traits"

dependencies {
api(libs.smithy.model)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$version: "2"

namespace amazon.smithy.llm
namespace smithy.ai

// Prompt template trait - applied at operation level to provide guidance to LLMs
@trait(selector: ":is(service, resource, operation)")
Expand All @@ -13,6 +13,7 @@ map prompts {
}

/// Defines the structure of the prompt
@private
structure PromptTemplateDefinition {
/// Description of when to use this operation
@required
Expand All @@ -29,5 +30,6 @@ structure PromptTemplateDefinition {
preferWhen: String
}

@private
@idRef(failWhenMissing: true, selector: "structure")
string ArgumentShape
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"plugins": {
"trait-codegen": {
"package": "software.amazon.smithy.ai",
"namespace": "amazon.smithy.llm",
"namespace": "smithy.ai",
"header": []
}
}
Expand Down
Loading