@@ -186,12 +186,37 @@ func AIDevOpsAgentTool(config *config.Config, client *client.IntelligenceService
186
186
return mcp .NewToolResultError (err .Error ()), nil
187
187
}
188
188
189
+ harnessContextRaw , err := OptionalParam [map [string ]interface {}](request , "harness_context" )
190
+ if err != nil {
191
+ return mcp .NewToolResultError (err .Error ()), nil
192
+ }
193
+
189
194
// Try to fetch scope parameters (account_id, org_id, project_id) if provided
190
195
scope , err := common .FetchScope (config , request , false )
191
196
if err != nil {
192
197
return mcp .NewToolResultError (err .Error ()), nil
193
198
}
194
199
200
+ // Create harness context from scope
201
+ harnessContext := & dto.HarnessContext {
202
+ AccountID : scope .AccountID ,
203
+ OrgID : scope .OrgID ,
204
+ ProjectID : scope .ProjectID ,
205
+ }
206
+
207
+ // Override with values from request if provided
208
+ if harnessContextRaw != nil {
209
+ if accountID , ok := harnessContextRaw ["account_id" ].(string ); ok && accountID != "" {
210
+ harnessContext .AccountID = accountID
211
+ }
212
+ if orgID , ok := harnessContextRaw ["org_id" ].(string ); ok && orgID != "" {
213
+ harnessContext .OrgID = orgID
214
+ }
215
+ if projectID , ok := harnessContextRaw ["project_id" ].(string ); ok && projectID != "" {
216
+ harnessContext .ProjectID = projectID
217
+ }
218
+ }
219
+
195
220
// Process context items
196
221
var contextItems []dto.ContextItem
197
222
for _ , ctxRaw := range contextRaw {
@@ -213,13 +238,6 @@ func AIDevOpsAgentTool(config *config.Config, client *client.IntelligenceService
213
238
interactionID = uuid .New ().String ()
214
239
}
215
240
216
- // Create harness context from scope
217
- harnessContext := & dto.HarnessContext {
218
- AccountID : scope .AccountID ,
219
- OrgID : scope .OrgID ,
220
- ProjectID : scope .ProjectID ,
221
- }
222
-
223
241
// Create AI DevOps request
224
242
aiRequest := & dto.ServiceChatParameters {
225
243
BaseRequestParameters : dto.BaseRequestParameters {
0 commit comments