Commit 6632d96
fix(tool/looker-conversational-analytics): OAuth token in GDA payload fix (#3058)
When using per-user OAuth (`use_client_oauth: true`), the
`ask_data_insights` tool fails to authenticate with the Gemini Data
Analytics API, while `get_models` and `get_explores` work correctly with
the same token.
The MCP server extracts the full `Authorization` header value (e.g.,
`"Bearer abc123"`) and passes it as `accessToken` to each tool's
`Invoke()` method. The `get_models`/`get_explores` tools pass this to
`GetLookerSDK()`, which sets it as an HTTP `Authorization` header where
the `"Bearer "` prefix is expected. However, `ask_data_insights` was
embedding the full `"Bearer abc123"` string into the JSON payload's
`access_token` field sent to the GDA API, which expects only the raw
token value.
The fix calls `accessToken.ParseBearerToken()` to strip the `"Bearer "`
prefix before placing the token into the `TokenBased` struct. This only
affects the OAuth code path; the `SecretBased` (client_id/client_secret)
path is unchanged.
### Before
```go
oauth_creds.Token = TokenBased{AccessToken: string(accessToken)}
// Produces: {"access_token": "Bearer abc123"} -- rejected by GDA API
```
### After
```go
rawToken, err := accessToken.ParseBearerToken()
oauth_creds.Token = TokenBased{AccessToken: rawToken}
// Produces: {"access_token": "abc123"} -- correct
```
### Files Changed
-
`internal/tools/looker/lookerconversationalanalytics/lookerconversationalanalytics.go`
## PR Checklist
- [x] Make sure you reviewed
[CONTRIBUTING.md](https://github.com/googleapis/mcp-toolbox/blob/main/CONTRIBUTING.md)
- [x] Make sure to open an issue as a
[bug/issue](https://github.com/googleapis/mcp-toolbox/issues/new/choose)
before writing your code! That way we can discuss the change, evaluate
designs, and agree on the general idea
- [ ] Ensure the tests and linter pass
- [ ] Code coverage does not decrease (if any source code was changed)
- [x] Appropriate docs were updated (if necessary)
- [x] Make sure to add `!` if this involve a breaking change
🛠️ Fixes #3057
---------
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: Mike DeAngelo <drstrangelove@google.com>1 parent f9e3e55 commit 6632d96
File tree
1 file changed
+5
-1
lines changed- internal/tools/looker/lookerconversationalanalytics
1 file changed
+5
-1
lines changedLines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
249 | 249 | | |
250 | 250 | | |
251 | 251 | | |
252 | | - | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
253 | 257 | | |
254 | 258 | | |
255 | 259 | | |
| |||
0 commit comments