{"record":{"id":"1642f1b44cd6b08b","repo":"googleapis/mcp-toolbox","slug":"tool-invocation-not-authorized-please-make-sure-y","errorCode":null,"errorMessage":"tool invocation not authorized. Please make sure you specify correct auth headers","messagePattern":"tool invocation not authorized\\. Please make sure you specify correct auth headers","errorType":"http","errorClass":null,"httpStatus":401,"severity":"error","filePath":"internal/server/api.go","lineNumber":241,"sourceCode":"\t\tif claims == nil {\n\t\t\t// authService not present in header\n\t\t\tcontinue\n\t\t}\n\t\tclaimsFromAuth[aS.GetName()] = claims\n\t}\n\n\t// Tool authorization check\n\tverifiedAuthServices := make([]string, len(claimsFromAuth))\n\ti := 0\n\tfor k := range claimsFromAuth {\n\t\tverifiedAuthServices[i] = k\n\t\ti++\n\t}\n\n\t// Check if any of the specified auth services is verified\n\tisAuthorized := tool.Authorized(verifiedAuthServices)\n\tif !isAuthorized {\n\t\terr = fmt.Errorf(\"tool invocation not authorized. Please make sure you specify correct auth headers\")\n\t\ts.logger.DebugContext(ctx, err.Error())\n\t\t_ = render.Render(w, r, newErrResponse(err, http.StatusUnauthorized))\n\t\treturn\n\t}\n\ts.logger.DebugContext(ctx, \"tool invocation authorized\")\n\n\tlimit := s.httpMaxRequestBytes\n\tr.Body = http.MaxBytesReader(w, r.Body, limit)\n\n\tvar data map[string]any\n\tif err = util.DecodeJSON(r.Body, &data); err != nil {\n\t\tvar maxErr *http.MaxBytesError\n\t\tif errors.As(err, &maxErr) {\n\t\t\terr = fmt.Errorf(\"request body exceeds %d bytes\", limit)\n\t\t\ts.logger.DebugContext(ctx, err.Error())\n\t\t\t_ = render.Render(w, r, newErrResponse(err, http.StatusRequestEntityTooLarge))\n\t\t\treturn\n\t\t}","sourceCodeStart":223,"sourceCodeEnd":259,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/server/api.go#L223-L259","documentation":"Error \"tool invocation not authorized. Please make sure you specify correct auth headers\" thrown in googleapis/mcp-toolbox.","triggerScenarios":"Thrown at internal/server/api.go:241 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8cc6e09de2ad7b8bffc77751799585a1401a48eb","analyzedAt":"2026-09-05T01:10:36.887Z","contentChangedAt":"2026-09-05T01:10:36.887Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}