MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / createSimpleMockToolset

Function createSimpleMockToolset

packages/kosong/test/step.test.ts:48–72  ·  view source on GitHub ↗

* Create a mock toolset that returns a simple success result for any tool call.

(
  handler?: (toolCall: ToolCall) => Promise<ToolResult> | ToolResult,
)

Source from the content-addressed store, hash-verified

46 * Create a mock toolset that returns a simple success result for any tool call.
47 */
48function createSimpleMockToolset(
49 handler?: (toolCall: ToolCall) => Promise<ToolResult> | ToolResult,
50): Toolset {
51 return {
52 tools: [
53 {
54 name: 'plus',
55 description: 'Add two numbers',
56 parameters: {
57 type: 'object',
58 properties: {
59 a: { type: 'integer' },
60 b: { type: 'integer' },
61 },
62 },
63 },
64 ],
65 handle:
66 handler ??
67 ((toolCall: ToolCall): ToolResult => ({
68 toolCallId: toolCall.id,
69 returnValue: toolOk({ output: 'mock-result' }),
70 })),
71 };
72}
73describe('step()', () => {
74 it('returns a StepResult with message, toolCalls, and toolResults', async () => {
75 const plusToolCall: ToolCall = {

Callers 1

step.test.tsFile · 0.85

Calls 1

toolOkFunction · 0.90

Tested by

no test coverage detected