Skip to content

Commit 0773cb6

Browse files
committed
fix(mcp): update function call syntax in system prompt and tool detail panel #371
1 parent 7423b7e commit 0773cb6

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

core/src/main/kotlin/cc/unitmesh/devti/mcp/editor/McpLlmConfigDialog.kt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@ data class McpLlmConfig(
2424
fun createSystemPrompt(): String {
2525
val systemPrompt = """
2626
In this environment you have access to a set of tools you can use to answer the user's question.
27-
You can invoke functions by writing a "<antml:function_calls>" block like the following as part of your reply to the user:
28-
<antml:function_calls>
29-
<antml:invoke name="${'$'}FUNCTION_NAME">
30-
<antml:parameter name="${'$'}PARAMETER_NAME">${'$'}PARAMETER_VALUE</antml:parameter>
27+
You can invoke functions by writing a "<devins:function_calls>" block like the following as part of your reply to the user:
28+
<devins:function_calls>
29+
<devins:invoke name="${'$'}FUNCTION_NAME">
30+
<devins:parameter name="${'$'}PARAMETER_NAME">${'$'}PARAMETER_VALUE</devins:parameter>
3131
...
32-
</antml:invoke>
33-
<antml:invoke name="${'$'}FUNCTION_NAME2">
32+
</devins:invoke>
33+
<devins:invoke name="${'$'}FUNCTION_NAME2">
3434
...
35-
</antml:invoke>
36-
</antml:function_calls>
35+
</devins:invoke>
36+
</devins:function_calls>
3737
3838
String and scalar parameters should be specified as is, while lists and objects should use JSON format.
3939
@@ -44,7 +44,7 @@ ${enabledTools.joinToString("\n") { tool -> "<function>" + Json.encodeToString(t
4444
4545
Answer the user's request using the relevant tool(s), if they are available. Check that all the required parameters for each tool call are provided or can reasonably be inferred from context. IF there are no relevant tools or there are missing values for required parameters, ask the user to supply these values; otherwise proceed with the tool calls. If the user provides a specific value for a parameter (for example provided in quotes), make sure to use that value EXACTLY. DO NOT make up values for or ask about optional parameters. Carefully analyze descriptive terms in the request as they may indicate required parameter values that should be included even if not explicitly quoted.
4646
47-
If you intend to call multiple tools and there are no dependencies between the calls, make all of the independent calls in the same <antml:function_calls></antml:function_calls> block.
47+
If you intend to call multiple tools and there are no dependencies between the calls, make all of the independent calls in the same <devins:function_calls></devins:function_calls> block.
4848
""".trimIndent()
4949
return systemPrompt
5050
}

core/src/main/kotlin/cc/unitmesh/devti/mcp/editor/McpToolDetailPanel.kt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,8 @@ class McpToolDetailPanel(
3939

4040
private fun buildCardUI() {
4141
background = UIUtil.getPanelBackground()
42-
border = CompoundBorder(
43-
BorderFactory.createLineBorder(borderColor),
44-
JBUI.Borders.empty(12)
45-
)
42+
border = CompoundBorder(BorderFactory.createLineBorder(borderColor), JBUI.Borders.empty(4))
4643
preferredSize = Dimension(TOOL_CARD_WIDTH, MAX_TOOL_CARD_HEIGHT)
47-
maximumSize = Dimension(Integer.MAX_VALUE, MAX_TOOL_CARD_HEIGHT)
4844

4945
val headerPanel = JPanel(BorderLayout(8, 4)).apply {
5046
background = UIUtil.getPanelBackground()

0 commit comments

Comments
 (0)