MCPcopy
hub / github.com/7836246/cursor2api / isToolCapabilityQuestion

Function isToolCapabilityQuestion

src/handler.ts:176–191  ·  view source on GitHub ↗
(body: AnthropicRequest)

Source from the content-addressed store, hash-verified

174}
175
176export function isToolCapabilityQuestion(body: AnthropicRequest): boolean {
177 if (!body.messages || body.messages.length === 0) return false;
178 const lastMsg = body.messages[body.messages.length - 1];
179 if (lastMsg.role !== 'user') return false;
180
181 let text = '';
182 if (typeof lastMsg.content === 'string') {
183 text = lastMsg.content;
184 } else if (Array.isArray(lastMsg.content)) {
185 for (const block of lastMsg.content) {
186 if (block.type === 'text' && block.text) text += block.text;
187 }
188 }
189
190 return TOOL_CAPABILITY_PATTERNS.some(p => p.test(text));
191}
192
193// ==================== 响应内容清洗 ====================
194

Callers 8

handleOpenAIStreamFunction · 0.85
handleOpenAINonStreamFunction · 0.85
handleResponsesStreamFunction · 0.85
handleResponsesNonStreamFunction · 0.85
handleDirectTextStreamFunction · 0.85
handleStreamFunction · 0.85
handleNonStreamFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected