-
Notifications
You must be signed in to change notification settings - Fork 42
Open
Labels
featureNew feature or requestNew feature or request
Description
Is your feature request related to a problem? Please describe.
Using a context parameter currently causes a compiler exception.
Describe the solution you'd like
Context parameters are supported, just like value parameters.
Describe alternatives you've considered
Not supporting context parameters. Why, though? They are a useful part of the language.
Additional context
Code:
@Rpc
interface ToolTestService {
@McpTool(
"basic_tool",
description = "A basic tool",
title = "Basic Tool",
readOnlyHint = true,
destructiveHint = false,
idempotentHint = true,
openWorldHint = false,
)
suspend fun basicTool(): String
@McpTool(
"context_tool"
)
context(ctx: McpRequestContext)
suspend fun contextTool(): String
object Impl : ToolTestService {
override suspend fun basicTool(): String = "test"
context(ctx: McpRequestContext)
override suspend fun contextTool(): String {
return "context"
}
}
}You can ignore the @McpTool annotations, they do not influence the compiler.
Full stacktrace: https://gist.github.com/rnett/ddd5020b79a759abd2d8cf1408495212
Metadata
Metadata
Assignees
Labels
featureNew feature or requestNew feature or request