mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 06:50:54 +07:00
LLM-19793 [aia, chat] fix reporting internal mcp tools into a wrong chat
Merge-request: IJ-MR-176967 Merged-by: Azad Abdulov <azad.abdulov@jetbrains.com> (cherry picked from commit dc0954be77c549cb9951d624c00d3b543f0039e0) (cherry picked from commit f3b1ac73c526f63d547939581d3cc2c4e5b99d14) IJ-MR-178622 GitOrigin-RevId: 8fdbafcb78cf37a28c0b2b211d9c5af493f272e7
This commit is contained in:
committed by
intellij-monorepo-bot
parent
1869158cb8
commit
4dbed7cc2b
@@ -20,7 +20,8 @@ class McpCallInfo(
|
||||
val mcpToolDescriptor: McpToolDescriptor,
|
||||
val rawArguments: JsonObject,
|
||||
val meta: JsonObject,
|
||||
val mcpSessionOptions: McpServerService.McpSessionOptions
|
||||
val mcpSessionOptions: McpServerService.McpSessionOptions,
|
||||
val headers: Map<String, List<String>> = emptyMap(),
|
||||
) {
|
||||
override fun toString(): String {
|
||||
return "McpCallAdditionalData(id=$callId, clientInfo=$clientInfo, toolName=${mcpToolDescriptor.name}"
|
||||
|
||||
@@ -38,6 +38,7 @@ import io.ktor.server.cio.CIOApplicationEngine
|
||||
import io.ktor.server.engine.EmbeddedServer
|
||||
import io.ktor.server.engine.embeddedServer
|
||||
import io.ktor.server.response.respond
|
||||
import io.ktor.util.toMap
|
||||
import io.modelcontextprotocol.kotlin.sdk.*
|
||||
import io.modelcontextprotocol.kotlin.sdk.server.RegisteredTool
|
||||
import io.modelcontextprotocol.kotlin.sdk.server.Server
|
||||
@@ -310,6 +311,7 @@ private fun McpTool.mcpToolToRegisteredTool(server: Server, projectPathFromIniti
|
||||
}
|
||||
|
||||
val authToken = httpRequest?.headers[IJ_MCP_AUTH_TOKEN]
|
||||
val headersWithoutAuthToken = httpRequest?.headers?.toMap()?.let { it - IJ_MCP_AUTH_TOKEN }
|
||||
|
||||
val sessionOptions = getSessionOptions(authToken)
|
||||
|
||||
@@ -324,7 +326,8 @@ private fun McpTool.mcpToolToRegisteredTool(server: Server, projectPathFromIniti
|
||||
mcpToolDescriptor = descriptor,
|
||||
rawArguments = request.arguments,
|
||||
meta = request._meta,
|
||||
mcpSessionOptions = sessionOptions
|
||||
mcpSessionOptions = sessionOptions,
|
||||
headers = headersWithoutAuthToken ?: emptyMap(),
|
||||
)
|
||||
|
||||
val callResult = coroutineScope {
|
||||
|
||||
Reference in New Issue
Block a user