import { ChangerawrClient } from '../client/changerawr-client.js';
// Tool interface
export interface MCPTool {
name: string;
description: string;
inputSchema: {
type: 'object';
properties: Record<string, any>;
required?: string[];
};
execute: (args: any, client: ChangerawrClient) => Promise<any>;
}
// Import individual tools
import { listProjectsTool } from './project-tools.js';
import { getProjectTool } from './project-tools.js';
import { createProjectTool } from './project-tools.js';
import { updateProjectTool } from './project-tools.js';
import { deleteProjectTool } from './project-tools.js';
import { listChangelogEntresTool } from './changelog-tools.js';
import { getChangelogEntryTool } from './changelog-tools.js';
import { createChangelogEntryTool } from './changelog-tools.js';
import { updateChangelogEntryTool } from './changelog-tools.js';
import { publishChangelogEntryTool } from './changelog-tools.js';
import { unpublishChangelogEntryTool } from './changelog-tools.js';
import { deleteChangelogEntryTool } from './changelog-tools.js';
import { createAndPublishChangelogEntryTool } from './changelog-tools.js';
import { listTagsTool } from './tag-tools.js';
import { createTagTool } from './tag-tools.js';
import { deleteTagTool } from './tag-tools.js';
import { getDashboardStatsTool } from './analytics-tools.js';
import { getProjectSettingsTool, updateProjectSettingsTool } from './settings-tools.js';
// Tool registry class
class ToolRegistry {
private tools: Map<string, MCPTool> = new Map();
constructor() {
this.registerTools();
}
private registerTools() {
// Project tools
this.register(listProjectsTool);
this.register(getProjectTool);
this.register(createProjectTool);
this.register(updateProjectTool);
this.register(deleteProjectTool);
// Changelog tools
this.register(listChangelogEntresTool);
this.register(getChangelogEntryTool);
this.register(createChangelogEntryTool);
this.register(updateChangelogEntryTool);
this.register(publishChangelogEntryTool);
this.register(unpublishChangelogEntryTool);
this.register(deleteChangelogEntryTool);
this.register(createAndPublishChangelogEntryTool);
// Tag tools
this.register(listTagsTool);
this.register(createTagTool);
this.register(deleteTagTool);
// Analytics tools
this.register(getDashboardStatsTool);
// Settings tools
this.register(getProjectSettingsTool);
this.register(updateProjectSettingsTool);
}
register(tool: MCPTool) {
this.tools.set(tool.name, tool);
}
getTool(name: string): MCPTool | undefined {
return this.tools.get(name);
}
getToolDefinitions() {
return Array.from(this.tools.values()).map(tool => ({
name: tool.name,
description: tool.description,
inputSchema: tool.inputSchema,
}));
}
listToolNames(): string[] {
return Array.from(this.tools.keys());
}
}
// Export singleton instance
export const toolRegistry = new ToolRegistry();