Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion internal/middleware/jqschema.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ func applyJqSchema(ctx context.Context, jsonData interface{}) (interface{}, erro
return nil, fmt.Errorf("jq schema filter not compiled (check startup logs): %w", jqSchemaCompileErr)
}

logMiddleware.Printf("applyJqSchema: starting schema inference, dataType=%T", jsonData)

Comment on lines +175 to +176
Copy link

Copilot AI May 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR description says logMiddleware was declared but never used, but this file already contains an existing logMiddleware.Printf("Applied default timeout...") call. Please update the PR description to reflect that the logger was already used (this PR adds additional debug lines rather than first usage).

Copilot uses AI. Check for mistakes.
// Ensure context has a timeout - add default if none exists
if _, hasDeadline := ctx.Deadline(); !hasDeadline {
var cancel context.CancelFunc
Expand Down Expand Up @@ -212,6 +214,7 @@ func applyJqSchema(ctx context.Context, jsonData interface{}) (interface{}, erro
}

// Return the schema object directly (no JSON marshaling needed here)
logMiddleware.Printf("applyJqSchema: schema inference completed, resultType=%T", v)
return v, nil
}

Expand Down Expand Up @@ -288,6 +291,8 @@ func WrapToolHandler(
sizeThreshold int,
getSessionID func(context.Context) string,
) func(context.Context, *sdk.CallToolRequest, interface{}) (*sdk.CallToolResult, interface{}, error) {
logMiddleware.Printf("WrapToolHandler: wrapping tool=%s, sizeThreshold=%d bytes, baseDir=%s, pathPrefixSet=%v",
toolName, sizeThreshold, baseDir, pathPrefix != "")
return func(ctx context.Context, req *sdk.CallToolRequest, args interface{}) (*sdk.CallToolResult, interface{}, error) {
// Generate random query ID
queryID := generateRandomID()
Expand Down Expand Up @@ -475,5 +480,7 @@ func WrapToolHandler(
// Currently applies to all tools, but can be configured to filter specific tools
func ShouldApplyMiddleware(toolName string) bool {
// Apply to all tools except sys tools
return !strings.HasPrefix(toolName, "sys___")
applies := !strings.HasPrefix(toolName, "sys___")
logMiddleware.Printf("ShouldApplyMiddleware: tool=%s, applies=%v", toolName, applies)
return applies
}
Loading