mirror of
https://github.com/esengine/DeepSeek-Reasonix.git
synced 2026-11-12 10:21:36 -10:00
Problem: doctor reports built-in review skills as referencing a missing use_capability tool, while capability diagnostics do not check those references. Root cause: the ordinary doctor passes no runtime tool inventory and relies on an incomplete name whitelist; its skill discovery also omits configured filters. Fix: share static host tool identities with runtime names, reuse compile-time built-ins, and route both diagnostic entrypoints through the same skill discovery and reference checks. Preserve unknown-name and MCP dependency warnings while marking unresolved dynamic references as unverified. Reuse existing MCP parsing semantics and observed host bindings without starting servers during static checks. Verification: full root Go tests, affected diagnostic package race tests, affected-package go vet, repolint, and isolated CLI checks passed. CLI checks observed zero provider requests and zero MCP starts. English and Chinese diagnostic documentation updated. Tool names, schemas, and permissions unchanged.
23 lines
794 B
Go
23 lines
794 B
Go
package tool
|
|
|
|
import "strings"
|
|
|
|
// ParseMCPServerReference accepts the server references used by skill allowlists.
|
|
func ParseMCPServerReference(id string) (server string, ok bool) {
|
|
if !strings.HasPrefix(id, "mcp-server:") {
|
|
return "", false
|
|
}
|
|
server = strings.TrimSpace(strings.TrimPrefix(id, "mcp-server:"))
|
|
return server, server != "" && !strings.Contains(server, "/")
|
|
}
|
|
|
|
// ParseMCPToolReference accepts the tool references used by skill allowlists.
|
|
func ParseMCPToolReference(id string) (server, raw string, ok bool) {
|
|
if !strings.HasPrefix(id, "mcp-tool:") {
|
|
return "", "", false
|
|
}
|
|
server, raw, cut := strings.Cut(strings.TrimPrefix(id, "mcp-tool:"), "/")
|
|
server, raw = strings.TrimSpace(server), strings.TrimSpace(raw)
|
|
return server, raw, cut && server != "" && raw != ""
|
|
}
|