mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-29 23:12:38 +08:00
fix(MCPService): Tool call failure caused by incorrect tool parameters
This commit is contained in:
parent
2e0d315ce4
commit
dfd957434c
@ -394,6 +394,13 @@ class McpService {
|
|||||||
): Promise<MCPCallToolResponse> {
|
): Promise<MCPCallToolResponse> {
|
||||||
try {
|
try {
|
||||||
Logger.info('[MCP] Calling:', server.name, name, args)
|
Logger.info('[MCP] Calling:', server.name, name, args)
|
||||||
|
if (typeof args === 'string') {
|
||||||
|
try {
|
||||||
|
args = JSON.parse(args)
|
||||||
|
} catch (e) {
|
||||||
|
Logger.error('[MCP] args parse error', args)
|
||||||
|
}
|
||||||
|
}
|
||||||
const client = await this.initClient(server)
|
const client = await this.initClient(server)
|
||||||
const result = await client.callTool({ name, arguments: args }, undefined, {
|
const result = await client.callTool({ name, arguments: args }, undefined, {
|
||||||
timeout: server.timeout ? server.timeout * 1000 : 60000 // Default timeout of 1 minute
|
timeout: server.timeout ? server.timeout * 1000 : 60000 // Default timeout of 1 minute
|
||||||
|
|||||||
@ -68,7 +68,7 @@ const PipRegistry: Registry[] = [
|
|||||||
{ name: '腾讯云', url: 'https://mirrors.cloud.tencent.com/pypi/simple/' }
|
{ name: '腾讯云', url: 'https://mirrors.cloud.tencent.com/pypi/simple/' }
|
||||||
]
|
]
|
||||||
|
|
||||||
type TabKey = 'settings' | 'tools' | 'prompts' | 'resources'
|
type TabKey = 'settings' | 'description' | 'tools' | 'prompts' | 'resources'
|
||||||
|
|
||||||
const parseKeyValueString = (str: string): Record<string, string> => {
|
const parseKeyValueString = (str: string): Record<string, string> => {
|
||||||
const result: Record<string, string> = {}
|
const result: Record<string, string> = {}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user