Skip to content

Commit b95f815

Browse files
committed
feat(mcp): add IssueEvaluateTool for issue analysis
Introduce a new tool `IssueEvaluateTool` to evaluate issues or stories within the project context. The tool sends the issue description to the sketch tool window for analysis and returns a response indicating the start of the analysis process. The tool is registered in `HostMcpToolManager`.
1 parent 47de9bd commit b95f815

File tree

3 files changed

+32
-1
lines changed

3 files changed

+32
-1
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package cc.unitmesh.devti.mcp.host
2+
3+
import cc.unitmesh.devti.gui.AutoDevToolWindowFactory
4+
import cc.unitmesh.devti.gui.chat.message.ChatActionType
5+
import com.intellij.openapi.project.Project
6+
import kotlinx.serialization.Serializable
7+
8+
@Serializable
9+
data class IssueArgs(val issue: String)
10+
11+
class IssueEvaluateTool : AbstractMcpTool<IssueArgs>() {
12+
override val name: String = "issue_or_story_evaluate"
13+
override val description: String = """
14+
This tool is used to evaluate an issue or story in the context of the project.
15+
Requires a issue parameter containing the issue description.
16+
Returns a the plan about this issue.
17+
""".trimIndent()
18+
19+
override fun handle(
20+
project: Project,
21+
args: IssueArgs
22+
): Response {
23+
val issue = args.issue
24+
25+
AutoDevToolWindowFactory.Companion.sendToSketchToolWindow(project, ChatActionType.SKETCH) { ui, _ ->
26+
ui.sendInput(issue)
27+
}
28+
29+
return Response("Start analysis in IDEA")
30+
}
31+
}

core/src/main/kotlin/cc/unitmesh/devti/mcp/host/HostMcpToolManager.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ class HostMcpToolManager {
3838
ExecuteActionByIdTool(),
3939
GetProgressIndicatorsTool(),
4040
WaitTool(),
41+
IssueEvaluateTool(),
4142
)
4243
}
4344
}

core/src/main/kotlin/cc/unitmesh/devti/observer/ChangeListObserver.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package cc.unitmesh.devti.observer
22

3-
import cc.unitmesh.devti.AutoDevNotifications
43
import cc.unitmesh.devti.observer.agent.AgentStateService
54
import cc.unitmesh.devti.provider.observer.AgentObserver
65
import com.intellij.openapi.Disposable

0 commit comments

Comments
 (0)