mirror of
https://github.com/voideditor/void
synced 2026-05-23 17:38:23 +00:00
opus 4 edits:
----
1. parse id code { "code": -32602, "name": "McpError" } out and display it to the user
2. deleting an mcp server from the mcp file doesnt work, the server remains
3. ui - non-wrapping tooltips should wrap
This commit is contained in:
parent
0625ce4b40
commit
f4557ef6a8
4 changed files with 62 additions and 8 deletions
|
|
@ -948,7 +948,7 @@ const MCPServerComponent = ({ name, server }: { name: string, server: MCPServer
|
|||
|
||||
data-tooltip-id='void-tooltip'
|
||||
data-tooltip-content={tool.description || ''}
|
||||
data-tooltip-class-name='void-max-w-[20px]'
|
||||
data-tooltip-class-name='void-max-w-[300px]'
|
||||
>
|
||||
{removeUniquePrefix(tool.name)}
|
||||
</span>
|
||||
|
|
@ -1140,7 +1140,7 @@ export const Settings = () => {
|
|||
className='hover:brightness-110'
|
||||
data-tooltip-id='void-tooltip'
|
||||
data-tooltip-content='We recommend using the largest qwen2.5-coder model you can with Ollama (try qwen2.5-coder:3b).'
|
||||
data-tooltip-class-name='void-max-w-[20px]'
|
||||
data-tooltip-class-name='void-max-w-[300px]'
|
||||
>
|
||||
Only works with FIM models.*
|
||||
</span>
|
||||
|
|
|
|||
|
|
@ -50,6 +50,8 @@ export const VoidTooltip = () => {
|
|||
padding: 0px 8px;
|
||||
border-radius: 6px;
|
||||
z-index: 999999;
|
||||
max-width: 300px;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
#void-tooltip {
|
||||
|
|
|
|||
|
|
@ -118,11 +118,21 @@ class MCPService extends Disposable implements IMCPService {
|
|||
}
|
||||
|
||||
private readonly _setMCPServerState = async (serverName: string, newServer: MCPServer | undefined) => {
|
||||
this.state = {
|
||||
...this.state,
|
||||
mcpServerOfName: {
|
||||
...this.state.mcpServerOfName,
|
||||
...newServer === undefined ? {} : { [serverName]: newServer, }
|
||||
if (newServer === undefined) {
|
||||
// Remove the server from the state
|
||||
const { [serverName]: removed, ...remainingServers } = this.state.mcpServerOfName;
|
||||
this.state = {
|
||||
...this.state,
|
||||
mcpServerOfName: remainingServers
|
||||
}
|
||||
} else {
|
||||
// Add or update the server
|
||||
this.state = {
|
||||
...this.state,
|
||||
mcpServerOfName: {
|
||||
...this.state.mcpServerOfName,
|
||||
[serverName]: newServer
|
||||
}
|
||||
}
|
||||
}
|
||||
this._onDidChangeState.fire();
|
||||
|
|
|
|||
|
|
@ -354,7 +354,49 @@ export class MCPChannel implements IServerChannel {
|
|||
const response = await this._callTool(serverName, toolName, params)
|
||||
return response
|
||||
} catch (err) {
|
||||
const fullErrorMessage = `❌ Failed to call tool "${toolName}" on server "${serverName}": ${typeof err === 'string' ? err : JSON.stringify(err, null, 2)}`
|
||||
let errorMessage: string;
|
||||
|
||||
// Check if it's an MCP error with a code
|
||||
if (err && typeof err === 'object' && 'code' in err) {
|
||||
const errorCode = (err as any).code;
|
||||
const errorName = (err as any).name || 'Unknown Error';
|
||||
const errorMsg = (err as any).message || '';
|
||||
|
||||
// Map common JSON-RPC error codes to user-friendly messages
|
||||
let codeDescription = '';
|
||||
switch (errorCode) {
|
||||
case -32700:
|
||||
codeDescription = 'Parse Error';
|
||||
break;
|
||||
case -32600:
|
||||
codeDescription = 'Invalid Request';
|
||||
break;
|
||||
case -32601:
|
||||
codeDescription = 'Method Not Found';
|
||||
break;
|
||||
case -32602:
|
||||
codeDescription = 'Invalid Parameters';
|
||||
break;
|
||||
case -32603:
|
||||
codeDescription = 'Internal Error';
|
||||
break;
|
||||
default:
|
||||
codeDescription = `Error Code ${errorCode}`;
|
||||
}
|
||||
|
||||
errorMessage = `${errorName} (${codeDescription})${errorMsg ? ': ' + errorMsg : ''}`;
|
||||
} else if (err && typeof err === 'object' && 'message' in err) {
|
||||
// Standard error with message
|
||||
errorMessage = (err as any).message;
|
||||
} else if (typeof err === 'string') {
|
||||
// String error
|
||||
errorMessage = err;
|
||||
} else {
|
||||
// Unknown error format
|
||||
errorMessage = JSON.stringify(err, null, 2);
|
||||
}
|
||||
|
||||
const fullErrorMessage = `❌ Failed to call tool "${toolName}" on server "${serverName}": ${errorMessage}`;
|
||||
const errorResponse: MCPToolErrorResponse = {
|
||||
event: 'error',
|
||||
text: fullErrorMessage,
|
||||
|
|
|
|||
Loading…
Reference in a new issue