clodds 1.6.15 → 1.6.16

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.
@@ -16690,18 +16690,20 @@ async function createAgentManager(config, feeds, db, sessionManager, sendMessage
16690
16690
  const extra = discoveredTools.filter(t => !seen.has(t.name));
16691
16691
  return [...tools, ...extra];
16692
16692
  };
16693
+ // Strip internal metadata before sending to API — Anthropic rejects extra fields
16694
+ const toApiTools = (defs) => defs.map(({ metadata: _, ...rest }) => rest);
16693
16695
  let response;
16694
16696
  try {
16695
- const activeTools = getActiveTools();
16697
+ const apiTools = toApiTools(getActiveTools());
16696
16698
  // Add cache_control to last tool for tool definition caching
16697
- if (activeTools.length > 0) {
16698
- activeTools[activeTools.length - 1].cache_control = { type: 'ephemeral' };
16699
+ if (apiTools.length > 0) {
16700
+ apiTools[apiTools.length - 1].cache_control = { type: 'ephemeral' };
16699
16701
  }
16700
16702
  response = await createMessage({
16701
16703
  model: modelId,
16702
16704
  max_tokens: 1024,
16703
16705
  system: systemBlocks,
16704
- tools: activeTools,
16706
+ tools: apiTools,
16705
16707
  messages,
16706
16708
  });
16707
16709
  }
@@ -16905,16 +16907,16 @@ async function createAgentManager(config, feeds, db, sessionManager, sendMessage
16905
16907
  }
16906
16908
  }
16907
16909
  try {
16908
- const activeTools = getActiveTools();
16910
+ const apiTools = toApiTools(getActiveTools());
16909
16911
  // Add cache_control to last tool for tool definition caching
16910
- if (activeTools.length > 0) {
16911
- activeTools[activeTools.length - 1].cache_control = { type: 'ephemeral' };
16912
+ if (apiTools.length > 0) {
16913
+ apiTools[apiTools.length - 1].cache_control = { type: 'ephemeral' };
16912
16914
  }
16913
16915
  response = await createMessage({
16914
16916
  model: modelId,
16915
16917
  max_tokens: 1024,
16916
16918
  system: systemBlocks,
16917
- tools: activeTools,
16919
+ tools: apiTools,
16918
16920
  messages,
16919
16921
  });
16920
16922
  }