MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / getToolCallNamesById

Function getToolCallNamesById

web/src/llm-api/kimi-tool-compat.ts:7–24  ·  view source on GitHub ↗
(
  messages: ChatCompletionRequestBody['messages'],
)

Source from the content-addressed store, hash-verified

5}
6
7function getToolCallNamesById(
8 messages: ChatCompletionRequestBody['messages'],
9): Map<string, string> {
10 const namesById = new Map<string, string>()
11
12 for (const message of messages) {
13 if (message.role !== 'assistant') {
14 continue
15 }
16 for (const toolCall of message.tool_calls ?? []) {
17 if (toolCall.id && toolCall.function.name) {
18 namesById.set(toolCall.id, toolCall.function.name)
19 }
20 }
21 }
22
23 return namesById
24}
25
26/**
27 * Kimi-compatible providers require two OpenAI-compatible extensions that are

Callers 1

Calls 1

setMethod · 0.80

Tested by

no test coverage detected