mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-21 09:17:53 +00:00
feat(core): Introduce DeclarativeTool and ToolInvocation. (#5613)
This commit is contained in:
@@ -21,7 +21,6 @@ import {
|
||||
sanitizeParameters,
|
||||
} from './tool-registry.js';
|
||||
import { DiscoveredMCPTool } from './mcp-tool.js';
|
||||
import { BaseTool, Icon, ToolResult } from './tools.js';
|
||||
import {
|
||||
FunctionDeclaration,
|
||||
CallableTool,
|
||||
@@ -32,6 +31,7 @@ import {
|
||||
import { spawn } from 'node:child_process';
|
||||
|
||||
import fs from 'node:fs';
|
||||
import { MockTool } from '../test-utils/tools.js';
|
||||
|
||||
vi.mock('node:fs');
|
||||
|
||||
@@ -107,28 +107,6 @@ const createMockCallableTool = (
|
||||
callTool: vi.fn(),
|
||||
});
|
||||
|
||||
class MockTool extends BaseTool<{ param: string }, ToolResult> {
|
||||
constructor(
|
||||
name = 'mock-tool',
|
||||
displayName = 'A mock tool',
|
||||
description = 'A mock tool description',
|
||||
) {
|
||||
super(name, displayName, description, Icon.Hammer, {
|
||||
type: Type.OBJECT,
|
||||
properties: {
|
||||
param: { type: Type.STRING },
|
||||
},
|
||||
required: ['param'],
|
||||
});
|
||||
}
|
||||
async execute(params: { param: string }): Promise<ToolResult> {
|
||||
return {
|
||||
llmContent: `Executed with ${params.param}`,
|
||||
returnDisplay: `Executed with ${params.param}`,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
const baseConfigParams: ConfigParameters = {
|
||||
cwd: '/tmp',
|
||||
model: 'test-model',
|
||||
|
||||
Reference in New Issue
Block a user