-
Notifications
You must be signed in to change notification settings - Fork 4
Fix context variable shadowing in server_sdk.go #22
Copy link
Copy link
Open
Labels
good first issueGood for newcomersGood for newcomershacktoberfestHacktoberfest eligibleHacktoberfest eligiblepriority: lowLow priorityLow prioritytype: bugSomething isn't workingSomething isn't working
Description
Summary
In `server_sdk.go`, a variable named `context` shadows the `context` package, which can cause confusion.
Current State
```go
// internal/mcp/server_sdk.go:155-157
if context, ok := req.Params.Arguments["context"]; ok {
args.Context = context
}
```
Problem
Using `context` as a variable name shadows the `context` package. While this doesn't cause a bug in this specific case (the package isn't used in this scope), it's a code smell that can lead to confusion and bugs in the future.
Expected Outcome
Rename the variable to avoid shadowing:
```go
if ctxArg, ok := req.Params.Arguments["context"]; ok {
args.Context = ctxArg
}
```
Or use a more descriptive name:
```go
if contextValue, ok := req.Params.Arguments["context"]; ok {
args.Context = contextValue
}
```
Acceptance Criteria
- Variable renamed to not shadow `context` package
- `go vet` passes without warnings
- All tests pass
- Consider enabling `shadow` check in golangci-lint (currently disabled)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomershacktoberfestHacktoberfest eligibleHacktoberfest eligiblepriority: lowLow priorityLow prioritytype: bugSomething isn't workingSomething isn't working