返回 DeepSeek-Reasonix
mcp_session_view.go
根目录 / desktop / mcp_session_view.go
1 package main
2
3 import "reasonix/internal/plugin"
4
5 func pluginServerToView(server plugin.ServerStatus) ServerView {
6 return ServerView{
7 Name: server.Name, Transport: server.Transport, Status: "connected",
8 RuntimeState: mcpSessionRuntimeState(server.SessionState),
9 Tools: server.Tools, Prompts: server.Prompts, Resources: server.Resources,
10 HasTools: server.HasTools, ToolList: pluginToolsToView(server.ToolList),
11 ProtocolVersion: server.ProtocolVersion, SessionState: string(server.SessionState),
12 ReconnectAttempts: server.ReconnectAttempts, ErrorKind: string(server.LastErrorKind), Error: server.LastError,
13 HostProfile: server.HostProfile, ElicitationNegotiated: server.ElicitationNegotiated, AppsNegotiated: server.AppsNegotiated,
14 }
15 }
16
17 func mcpSessionRuntimeState(state plugin.SessionState) string {
18 switch state {
19 case plugin.SessionStateConnecting, plugin.SessionStateListening, plugin.SessionStateReconnecting:
20 return "connecting"
21 case plugin.SessionStateFailed:
22 return "issue"
23 default:
24 return "ready"
25 }
26 }
27
27 lines GO