converse-mcp-server 2.6.1 → 2.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/providers/anthropic.js +72 -9
package/package.json
CHANGED
|
@@ -13,6 +13,35 @@ import { ProviderError, ErrorCodes, StopReasons } from './interface.js';
|
|
|
13
13
|
|
|
14
14
|
// Define supported Claude models with their capabilities
|
|
15
15
|
const SUPPORTED_MODELS = {
|
|
16
|
+
'claude-opus-4-5-20251101': {
|
|
17
|
+
modelName: 'claude-opus-4-5-20251101',
|
|
18
|
+
friendlyName: 'Claude Opus 4.5',
|
|
19
|
+
contextWindow: 200000,
|
|
20
|
+
maxOutputTokens: 64000,
|
|
21
|
+
supportsStreaming: true,
|
|
22
|
+
supportsImages: true,
|
|
23
|
+
supportsTemperature: true,
|
|
24
|
+
supportsWebSearch: false,
|
|
25
|
+
supportsThinking: true,
|
|
26
|
+
minThinkingTokens: 1024,
|
|
27
|
+
maxThinkingTokens: 64000,
|
|
28
|
+
timeout: 300000,
|
|
29
|
+
supportsEffort: true, // Opus 4.5 exclusive effort parameter
|
|
30
|
+
description:
|
|
31
|
+
'Claude Opus 4.5 - Most intelligent model combining maximum capability with practical performance',
|
|
32
|
+
aliases: [
|
|
33
|
+
'claude-opus-4-5',
|
|
34
|
+
'claude-4.5-opus',
|
|
35
|
+
'claude-4-5-opus',
|
|
36
|
+
'opus-4.5',
|
|
37
|
+
'opus-4-5',
|
|
38
|
+
'opus4.5',
|
|
39
|
+
'opus4-5',
|
|
40
|
+
'claude-opus-4.5',
|
|
41
|
+
'opus',
|
|
42
|
+
'claude-opus',
|
|
43
|
+
],
|
|
44
|
+
},
|
|
16
45
|
'claude-opus-4-1-20250805': {
|
|
17
46
|
modelName: 'claude-opus-4-1-20250805',
|
|
18
47
|
friendlyName: 'Claude Opus 4.1',
|
|
@@ -36,11 +65,9 @@ const SUPPORTED_MODELS = {
|
|
|
36
65
|
'opus-4-1',
|
|
37
66
|
'claude-4-opus',
|
|
38
67
|
'opus-4',
|
|
39
|
-
'opus',
|
|
40
|
-
'claude-opus',
|
|
41
|
-
'claude-opus-4',
|
|
42
68
|
'opus4',
|
|
43
69
|
'opus4.1',
|
|
70
|
+
'claude-opus-4',
|
|
44
71
|
'claude-opus-4.1',
|
|
45
72
|
],
|
|
46
73
|
},
|
|
@@ -202,6 +229,18 @@ const THINKING_BUDGETS = {
|
|
|
202
229
|
max: 1.0, // 100% of max thinking tokens
|
|
203
230
|
};
|
|
204
231
|
|
|
232
|
+
/**
|
|
233
|
+
* Effort parameter mapping for Opus 4.5
|
|
234
|
+
* Maps reasoning_effort values to Anthropic's effort parameter values
|
|
235
|
+
*/
|
|
236
|
+
const EFFORT_MAP = {
|
|
237
|
+
minimal: 'low',
|
|
238
|
+
low: 'low',
|
|
239
|
+
medium: 'medium',
|
|
240
|
+
high: 'high',
|
|
241
|
+
max: 'high',
|
|
242
|
+
};
|
|
243
|
+
|
|
205
244
|
/**
|
|
206
245
|
* Custom error class for Anthropic provider errors
|
|
207
246
|
*/
|
|
@@ -496,6 +535,14 @@ export const anthropicProvider = {
|
|
|
496
535
|
);
|
|
497
536
|
}
|
|
498
537
|
|
|
538
|
+
// Add effort beta feature for Opus 4.5
|
|
539
|
+
if (modelConfig.supportsEffort && reasoning_effort) {
|
|
540
|
+
betas.push('effort-2025-11-24');
|
|
541
|
+
debugLog(
|
|
542
|
+
`[Anthropic] Model ${resolvedModel} supports effort parameter with beta feature`,
|
|
543
|
+
);
|
|
544
|
+
}
|
|
545
|
+
|
|
499
546
|
// Convert messages to Anthropic format (system messages are always cached)
|
|
500
547
|
const { systemPrompt, messages: anthropicMessages } =
|
|
501
548
|
convertMessagesToAnthropic(messages);
|
|
@@ -539,12 +586,14 @@ export const anthropicProvider = {
|
|
|
539
586
|
// For other models, check against max_tokens if set
|
|
540
587
|
const maxTokensLimit =
|
|
541
588
|
requestPayload.max_tokens ||
|
|
542
|
-
(resolvedModel.includes('claude-opus-4')
|
|
543
|
-
?
|
|
544
|
-
: resolvedModel.includes('claude-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
589
|
+
(resolvedModel.includes('claude-opus-4-5')
|
|
590
|
+
? 64000
|
|
591
|
+
: resolvedModel.includes('claude-opus-4')
|
|
592
|
+
? 32000
|
|
593
|
+
: resolvedModel.includes('claude-sonnet-4-5') ||
|
|
594
|
+
resolvedModel.includes('claude-sonnet-4')
|
|
595
|
+
? 64000
|
|
596
|
+
: modelConfig.maxOutputTokens);
|
|
548
597
|
|
|
549
598
|
if (thinkingBudget > 0 && thinkingBudget < maxTokensLimit) {
|
|
550
599
|
// According to Anthropic docs: thinking tokens count towards max_tokens limit
|
|
@@ -574,6 +623,19 @@ export const anthropicProvider = {
|
|
|
574
623
|
}
|
|
575
624
|
}
|
|
576
625
|
|
|
626
|
+
// Add effort parameter for Opus 4.5 (uses output_config)
|
|
627
|
+
if (modelConfig.supportsEffort && reasoning_effort && reasoning_effort !== 'none') {
|
|
628
|
+
const effortValue = EFFORT_MAP[reasoning_effort];
|
|
629
|
+
if (effortValue) {
|
|
630
|
+
requestPayload.output_config = {
|
|
631
|
+
effort: effortValue,
|
|
632
|
+
};
|
|
633
|
+
debugLog(
|
|
634
|
+
`[Anthropic] Effort parameter set to "${effortValue}" for ${resolvedModel} (from reasoning_effort: ${reasoning_effort})`,
|
|
635
|
+
);
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
|
|
577
639
|
// If streaming is requested and model doesn't support it, fall back to non-streaming
|
|
578
640
|
if (stream && modelConfig.supportsStreaming === false) {
|
|
579
641
|
debugLog(
|
|
@@ -605,6 +667,7 @@ export const anthropicProvider = {
|
|
|
605
667
|
max_tokens: requestPayload.max_tokens,
|
|
606
668
|
thinking: requestPayload.thinking,
|
|
607
669
|
temperature: requestPayload.temperature,
|
|
670
|
+
output_config: requestPayload.output_config,
|
|
608
671
|
betas: requestPayload.betas,
|
|
609
672
|
message_count: requestPayload.messages?.length,
|
|
610
673
|
system_length: Array.isArray(requestPayload.system)
|