fixed google s2s mcp initiate wrong functionDeclarations (#1203)

* fixed google s2s mcp initiate wrong functionDeclarations

* populate model from llm verb to google setup message
This commit is contained in:
Hoan Luu Huu
2025-05-19 07:15:26 +07:00
committed by GitHub
parent 761b7f26e7
commit b92a9c700e

View File

@@ -53,6 +53,7 @@ class TaskLlmGoogle_S2S extends Task {
}
this.setup = {
...setup,
model: this.model,
// make sure output is always audio
generationConfig: {
...(setup.generationConfig || {}),
@@ -161,16 +162,21 @@ class TaskLlmGoogle_S2S extends Task {
const setup = this.setup;
const mcpTools = this.parent.isMcpEnabled ? await this.parent.mcpService.getAvailableMcpTools() : [];
if (mcpTools && mcpTools.length > 0) {
const convertedTools = mcpTools.map((tool) => {
return {
functionDeclarations: {
name: tool.name,
description: tool.description,
parameters: tool.inputSchema,
}
};
}
);
const convertedTools = [
{
functionDeclarations: mcpTools.map((tool) => {
if (tool.inputSchema) {
delete tool.inputSchema.additionalProperties;
delete tool.inputSchema['$schema'];
}
return {
name: tool.name,
description: tool.description,
parameters: tool.inputSchema,
};
})
}
];
// merge with any existing tools
setup.tools = [...convertedTools, ...(this.setup.tools || [])];
}