- Standardized error handling across tool implementations - Improved return type consistency for tool execution results - Simplified configuration parsing and type definitions - Enhanced type safety for various configuration schemas - Cleaned up and normalized tool response structures - Updated SSE and event subscription tool implementations
77 lines
1.7 KiB
TypeScript
77 lines
1.7 KiB
TypeScript
import { Tool } from "../types/index.js";
|
|
import { listDevicesTool } from "./list-devices.tool.js";
|
|
import { controlTool } from "./control.tool.js";
|
|
import { historyTool } from "./history.tool.js";
|
|
import { sceneTool } from "./scene.tool.js";
|
|
import { notifyTool } from "./notify.tool.js";
|
|
import { automationTool } from "./automation.tool.js";
|
|
import { addonTool } from "./addon.tool.js";
|
|
import { packageTool } from "./package.tool.js";
|
|
import { automationConfigTool } from "./automation-config.tool.js";
|
|
import { subscribeEventsTool } from "./subscribe-events.tool.js";
|
|
import { getSSEStatsTool } from "./sse-stats.tool.js";
|
|
|
|
// Tool category types
|
|
export enum ToolCategory {
|
|
DEVICE = "device",
|
|
SYSTEM = "system",
|
|
AUTOMATION = "automation",
|
|
}
|
|
|
|
// Tool priority levels
|
|
export enum ToolPriority {
|
|
HIGH = "high",
|
|
MEDIUM = "medium",
|
|
LOW = "low",
|
|
}
|
|
|
|
interface ToolMetadata {
|
|
category: ToolCategory;
|
|
platform: string;
|
|
version: string;
|
|
caching?: {
|
|
enabled: boolean;
|
|
ttl: number;
|
|
};
|
|
}
|
|
|
|
// Array to track all tools
|
|
export const tools: Tool[] = [
|
|
listDevicesTool,
|
|
controlTool,
|
|
historyTool,
|
|
sceneTool,
|
|
notifyTool,
|
|
automationTool,
|
|
addonTool,
|
|
packageTool,
|
|
automationConfigTool,
|
|
subscribeEventsTool,
|
|
getSSEStatsTool,
|
|
];
|
|
|
|
// Function to get a tool by name
|
|
export function getToolByName(name: string): Tool | undefined {
|
|
return tools.find((tool) => tool.name === name);
|
|
}
|
|
|
|
// Function to get all tools
|
|
export function getAllTools(): Tool[] {
|
|
return [...tools];
|
|
}
|
|
|
|
// Export all tools individually
|
|
export {
|
|
listDevicesTool,
|
|
controlTool,
|
|
historyTool,
|
|
sceneTool,
|
|
notifyTool,
|
|
automationTool,
|
|
addonTool,
|
|
packageTool,
|
|
automationConfigTool,
|
|
subscribeEventsTool,
|
|
getSSEStatsTool,
|
|
};
|