This is an automated email from the ASF dual-hosted git repository. kezhenxu94 pushed a commit to branch temp in repository https://gitbox.apache.org/repos/asf/skywalking-mcp.git
commit 6e3f1f8033da76f7d945dab6ca2218459221944e Author: kezhenxu94 <kezhenx...@apache.org> AuthorDate: Wed Aug 20 11:32:01 2025 +0700 remove logs/traces --- go.mod | 2 +- go.sum | 2 ++ internal/swmcp/server.go | 4 ++-- internal/tools/log.go | 12 +++++++++++- internal/tools/trace.go | 14 +++++++++++--- 5 files changed, 27 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index bbdd707..fa314d4 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.24.3 require ( github.com/apache/skywalking-cli v0.0.0-20250604010708-77b4c49e89c9 - github.com/mark3labs/mcp-go v0.37.0 + github.com/mark3labs/mcp-go v0.37.1-0.20250812151906-9f16336f83e1 github.com/sirupsen/logrus v1.9.3 github.com/spf13/cobra v1.9.1 github.com/spf13/viper v1.20.1 diff --git a/go.sum b/go.sum index f469b72..bf535e9 100644 --- a/go.sum +++ b/go.sum @@ -33,6 +33,8 @@ github.com/mailru/easyjson v0.9.0 h1:PrnmzHw7262yW8sTBwxi1PdJA3Iw/EKBa8psRf7d9a4 github.com/mailru/easyjson v0.9.0/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU= github.com/mark3labs/mcp-go v0.37.0 h1:BywvZLPRT6Zx6mMG/MJfxLSZQkTGIcJSEGKsvr4DsoQ= github.com/mark3labs/mcp-go v0.37.0/go.mod h1:T7tUa2jO6MavG+3P25Oy/jR7iCeJPHImCZHRymCn39g= +github.com/mark3labs/mcp-go v0.37.1-0.20250812151906-9f16336f83e1 h1:kLQh+OHCJXv/AYpl8IvIhl9Cth814991JJQUJav/tRQ= +github.com/mark3labs/mcp-go v0.37.1-0.20250812151906-9f16336f83e1/go.mod h1:T7tUa2jO6MavG+3P25Oy/jR7iCeJPHImCZHRymCn39g= github.com/matryer/is v1.4.0 h1:sosSmIWwkYITGrxZ25ULNDeKiMNzFSr4V/eqBQP0PeE= github.com/matryer/is v1.4.0/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU= github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4= diff --git a/internal/swmcp/server.go b/internal/swmcp/server.go index da406fa..e3a13f7 100644 --- a/internal/swmcp/server.go +++ b/internal/swmcp/server.go @@ -45,9 +45,9 @@ func newMcpServer() *server.MCPServer { server.WithLogging()) // add tools and capabilities to the MCP server - tools.AddTraceTools(mcpServer) + // tools.AddTraceTools(mcpServer) tools.AddMetricsTools(mcpServer) - tools.AddLogTools(mcpServer) + // tools.AddLogTools(mcpServer) tools.AddMQETools(mcpServer) // add MQE documentation resources diff --git a/internal/tools/log.go b/internal/tools/log.go index 1d5e2a6..b50f1fd 100644 --- a/internal/tools/log.go +++ b/internal/tools/log.go @@ -116,7 +116,17 @@ Examples: mcp.WithString("service_instance_id", mcp.Description("Service instance ID to filter logs.")), mcp.WithString("endpoint_id", mcp.Description("Endpoint ID to filter logs.")), mcp.WithString("trace_id", mcp.Description("Related trace ID.")), - mcp.WithArray("tags", mcp.Description("Array of log tags, each with key and value.")), + mcp.WithArray("tags", + mcp.Items(map[string]any{ + "type": "object", + "properties": map[string]any{ + "key": map[string]any{"type": "string"}, + "value": map[string]any{"type": "string"}, + }, + "required": []string{"key", "value"}, + }), + mcp.Description("Array of log tags, each with key and value."), + ), mcp.WithString("start", mcp.Description("Start time for the query.")), mcp.WithString("end", mcp.Description("End time for the query.")), mcp.WithString("step", mcp.Enum("SECOND", "MINUTE", "HOUR", "DAY"), diff --git a/internal/tools/trace.go b/internal/tools/trace.go index fb5f85b..5f11682 100644 --- a/internal/tools/trace.go +++ b/internal/tools/trace.go @@ -515,7 +515,8 @@ func processTracesResult(traces *api.TraceBrief, view string, slowTraceThreshold func processTraceItem(traceItem *api.BasicTrace, summary *TracesSummary, services, endpoints map[string]struct{}, durations *[]int64, errorTraces, slowTraces *[]BasicTraceSummary, slowTraceThreshold int64, - minStartTime, maxEndTime *int64, totalDuration *int64) { + minStartTime, maxEndTime *int64, totalDuration *int64, +) { if traceItem == nil { return } @@ -607,8 +608,7 @@ func generateTracesSummary(traces *api.TraceBrief, slowTraceThreshold int64) *Tr } // Calculate statistics - summary.AvgDuration, summary.MinDuration, summary.MaxDuration = - calculateStatistics(durations, totalDuration) + summary.AvgDuration, summary.MinDuration, summary.MaxDuration = calculateStatistics(durations, totalDuration) // Set time range summary.TimeRange = TimeRange{ @@ -850,6 +850,14 @@ Examples: "Examples: 500 (0.5s), 2000 (2s), 5000 (5s)"), ), mcp.WithArray("tags", + mcp.Items(map[string]any{ + "type": "object", + "properties": map[string]any{ + "key": map[string]any{"type": "string"}, + "value": map[string]any{"type": "string"}, + }, + "required": []string{"key", "value"}, + }), mcp.Description(`Array of span tags to filter traces. Each tag should have 'key' and 'value' fields. Examples: [{"key": "http.method", "value": "POST"}, {"key": "http.status_code", "value": "500"}]`), ),