Skip to content

Commit 3ed3627

Browse files
[Tiny Agents] Add dummy parameters field to exit loop tools (#1624)
Follow-up PR to #1610. Some LLM engines (like llama.cpp) strictly validate the `parameters` field in function definitions, even for tools that take no arguments. To avoid parsing issues, this PR adds an explicit dummy `parameters` field. (See: huggingface/huggingface_hub#3218) ✅ I tested the PR with different providers/models to make sure it's backward compatible.
1 parent 401739a commit 3ed3627

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

packages/mcp-client/src/Agent.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,31 @@ const taskCompletionTool: ChatCompletionInputTool = {
2525
function: {
2626
name: "task_complete",
2727
description: "Call this tool when the task given by the user is complete",
28+
parameters: {
29+
type: "object",
30+
properties: {
31+
trigger: {
32+
type: "boolean",
33+
description: "Set to true to trigger this function",
34+
},
35+
},
36+
},
2837
},
2938
};
3039
const askQuestionTool: ChatCompletionInputTool = {
3140
type: "function",
3241
function: {
3342
name: "ask_question",
3443
description: "Ask a question to the user to get more info required to solve or clarify their problem.",
44+
parameters: {
45+
type: "object",
46+
properties: {
47+
trigger: {
48+
type: "boolean",
49+
description: "Set to true to trigger this function",
50+
},
51+
},
52+
},
3553
},
3654
};
3755
const exitLoopTools = [taskCompletionTool, askQuestionTool];

0 commit comments

Comments
 (0)