executeTool
codebolt.mcp.executeTool(toolName: string, params: any, mcpServer: string (optional)): Promise<any>
Executes a specified tool with the provided parameters via WebSocket connection.
Parameters
Name | Type | Description |
---|---|---|
toolName | string | The name of the tool to execute |
params | any | Parameters to pass to the tool |
mcpServer | string (optional) | Target MCP server URL (uses default connection if not specified) |
Returns:
Promise<any>
A promise that resolves with execution result or rejects with errorExample
// Execute a data processing tool
try {
const result = await codeboltMCP.executeTool(
"dataProcessor",
{
operation: "encrypt",
payload: "sensitive-data-123"
},
"wss://production-mcp.example.com"
);
console.log("Execution Result:", result);
} catch (error) {
console.error("Execution Failed:", error);
}