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
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import { v4 as uuidv4 } from 'uuid';
import { McpToolServerConfigurationService, Utility, ToolOptions, ChatHistoryMessage } from '@microsoft/agents-a365-tooling';
import { AgenticAuthenticationService, Utility as RuntimeUtility, OperationResult, OperationError } from '@microsoft/agents-a365-runtime';
import { AgenticAuthenticationService, Utility as RuntimeUtility, OperationResult } from '@microsoft/agents-a365-runtime';

// Agents SDK
import { TurnContext, Authorization } from '@microsoft/agents-hosting';
Expand Down Expand Up @@ -117,22 +117,15 @@ export class McpToolRegistrationService {
throw new Error('session is required');
}

try {
// Extract messages from session
const items = await session.getItems(limit);

// Delegate to the list-based method
return await this.sendChatHistoryMessagesAsync(
turnContext,
items,
toolOptions
);
} catch (err) {
if (err instanceof Error && err.message.includes('is required')) {
throw err; // Re-throw validation errors
}
return OperationResult.failed(new OperationError(err as Error));
}
// Extract messages from session
const items = await session.getItems(limit);

// Delegate to the list-based method
return await this.sendChatHistoryMessagesAsync(
turnContext,
items,
toolOptions
);
}

/**
Expand Down Expand Up @@ -178,22 +171,15 @@ export class McpToolRegistrationService {
orchestratorName: toolOptions?.orchestratorName ?? this.orchestratorName
};

try {
// Convert OpenAI messages to ChatHistoryMessage format
const chatHistoryMessages = this.convertToChatHistoryMessages(messages);

// Delegate to core service
return await this.configService.sendChatHistory(
turnContext,
chatHistoryMessages,
effectiveOptions
);
} catch (err) {
if (err instanceof Error && err.message.includes('is required')) {
throw err; // Re-throw validation errors
}
return OperationResult.failed(new OperationError(err as Error));
}
// Convert OpenAI messages to ChatHistoryMessage format
const chatHistoryMessages = this.convertToChatHistoryMessages(messages);

// Delegate to core service
return await this.configService.sendChatHistory(
turnContext,
chatHistoryMessages,
effectiveOptions
);
}

/**
Expand Down