orchestry-mcp
Version:
Orchestry MCP Server for multi-session task management
475 lines (458 loc) • 18.1 kB
JavaScript
export class OrchestryTools {
db;
io;
constructor(db, io) {
this.db = db;
this.io = io;
}
getToolDefinitions() {
return [
{
name: 'create_project',
description: `Create a new project for multi-session task management.
Example: create_project("E-commerce Platform", "Build a modern e-commerce platform")`,
inputSchema: {
type: 'object',
properties: {
name: { type: 'string', description: 'Project name' },
description: { type: 'string', description: 'Project description' },
sessionId: { type: 'string', description: 'Optional session ID for multi-session support' },
},
required: ['name', 'description'],
},
},
{
name: 'list_projects',
description: `List all available projects.
Example: list_projects()`,
inputSchema: {
type: 'object',
properties: {},
},
},
{
name: 'create_workspace',
description: `Create a workspace to organize related goals and tasks.
Example: create_workspace(projectId, {
name: "Backend Development",
description: "API and database work",
color: "#4F46E5"
})`,
inputSchema: {
type: 'object',
properties: {
projectId: { type: 'string' },
name: { type: 'string' },
description: { type: 'string' },
color: { type: 'string', description: 'Hex color for UI' },
icon: { type: 'string', description: 'Icon identifier' },
},
required: ['projectId', 'name'],
},
},
{
name: 'create_goal',
description: `Create a goal within a workspace to define objectives.
Example: create_goal(workspaceId, {
title: "Implement Authentication",
priority: "high",
successCriteria: ["JWT tokens working", "OAuth2 integration"],
targetDate: "2024-03-01"
})`,
inputSchema: {
type: 'object',
properties: {
workspaceId: { type: 'string' },
title: { type: 'string' },
description: { type: 'string' },
priority: {
type: 'string',
enum: ['critical', 'high', 'medium', 'low'],
},
successCriteria: {
type: 'array',
items: { type: 'string' },
},
targetDate: { type: 'string', format: 'date' },
},
required: ['workspaceId', 'title'],
},
},
{
name: 'create_task',
description: `Create a task within a goal or as a subtask.
Example: create_task(goalId, {
title: "Setup JWT middleware",
status: "todo",
priority: "high",
estimatedHours: 4
})`,
inputSchema: {
type: 'object',
properties: {
goalId: { type: 'string' },
parentTaskId: { type: 'string', description: 'Optional parent task for subtasks' },
title: { type: 'string' },
description: { type: 'string' },
status: {
type: 'string',
enum: ['backlog', 'todo', 'in_progress', 'review', 'done', 'blocked'],
},
priority: {
type: 'string',
enum: ['critical', 'high', 'medium', 'low'],
},
assigneeId: { type: 'string' },
dueDate: { type: 'string', format: 'date' },
estimatedHours: { type: 'number' },
checklist: {
type: 'array',
items: {
type: 'object',
properties: {
text: { type: 'string' },
completed: { type: 'boolean' },
},
},
},
dependencies: {
type: 'array',
items: { type: 'string' },
description: 'IDs of other tasks this depends on',
},
tags: {
type: 'array',
items: { type: 'string' },
},
sessionNotes: { type: 'string', description: 'Notes from the current session' },
},
required: ['goalId', 'title'],
},
},
{
name: 'update_task_status',
description: `Update the status of a task.
Example: update_task_status("task-123", "in_progress")`,
inputSchema: {
type: 'object',
properties: {
taskId: { type: 'string' },
status: {
type: 'string',
enum: ['backlog', 'todo', 'in_progress', 'review', 'done', 'blocked'],
},
},
required: ['taskId', 'status'],
},
},
{
name: 'create_session',
description: `Create a new session for multi-session support.
Track different work contexts or LLM interactions.
Example: create_session(projectId, {
name: "Claude Session 1",
type: "llm",
llmModel: "claude-3"
})`,
inputSchema: {
type: 'object',
properties: {
projectId: { type: 'string' },
name: { type: 'string' },
type: {
type: 'string',
enum: ['human', 'llm', 'hybrid'],
},
llmModel: { type: 'string', description: 'LLM model name if type is llm' },
context: { type: 'string', description: 'Session-specific context' },
},
required: ['projectId', 'name'],
},
},
{
name: 'get_active_sessions',
description: `Get all active sessions for a project.
Useful for multi-session coordination.
Example: get_active_sessions("project-123")`,
inputSchema: {
type: 'object',
properties: {
projectId: { type: 'string' },
},
required: ['projectId'],
},
},
{
name: 'link_document',
description: `Link a document to any entity (project, workspace, goal, or task).
Example: link_document("goal-123", "goal", {
type: "requirement",
title: "Auth System Requirements",
content: "## Overview\\n..."
})`,
inputSchema: {
type: 'object',
properties: {
entityId: { type: 'string', description: 'ID of the entity to link to' },
entityType: {
type: 'string',
enum: ['project', 'workspace', 'goal', 'task'],
},
document: {
type: 'object',
properties: {
type: {
type: 'string',
enum: ['requirement', 'technical_spec', 'design', 'meeting_notes', 'analysis', 'report', 'documentation'],
},
title: { type: 'string' },
content: { type: 'string', description: 'Markdown content' },
url: { type: 'string', description: 'External document URL' },
},
required: ['type', 'title'],
},
},
required: ['entityId', 'entityType', 'document'],
},
},
{
name: 'get_kanban_board',
description: `Get the kanban board view for a project.
Returns all tasks grouped by status.
Example: get_kanban_board("project-123")`,
inputSchema: {
type: 'object',
properties: {
projectId: { type: 'string' },
filters: {
type: 'object',
properties: {
workspaceId: { type: 'string' },
goalId: { type: 'string' },
assigneeId: { type: 'string' },
priority: {
type: 'string',
enum: ['critical', 'high', 'medium', 'low'],
},
sessionId: { type: 'string' },
},
},
},
required: ['projectId'],
},
},
{
name: 'get_project_hierarchy',
description: `Get the complete project hierarchy.
Shows: Project > Workspaces > Goals > Tasks
Example: get_project_hierarchy("project-123")`,
inputSchema: {
type: 'object',
properties: {
projectId: { type: 'string' },
},
required: ['projectId'],
},
},
{
name: 'get_project_stats',
description: `Get statistics for a project.
Includes task counts, session info, and progress metrics.
Example: get_project_stats("project-123")`,
inputSchema: {
type: 'object',
properties: {
projectId: { type: 'string' },
},
required: ['projectId'],
},
},
{
name: 'search_tasks',
description: `Search for tasks across the project.
Example: search_tasks({query: "authentication", status: "in_progress"})`,
inputSchema: {
type: 'object',
properties: {
query: { type: 'string', description: 'Text search query' },
status: {
type: 'string',
enum: ['backlog', 'todo', 'in_progress', 'review', 'done', 'blocked'],
},
priority: {
type: 'string',
enum: ['critical', 'high', 'medium', 'low'],
},
assigneeId: { type: 'string' },
tags: {
type: 'array',
items: { type: 'string' },
},
workspaceId: { type: 'string' },
goalId: { type: 'string' },
sessionId: { type: 'string' },
},
},
},
];
}
async executeTool(name, args) {
switch (name) {
case 'create_project':
return this.createProject(args);
case 'list_projects':
return this.listProjects();
case 'create_workspace':
return this.createWorkspace(args);
case 'create_goal':
return this.createGoal(args);
case 'create_task':
return this.createTask(args);
case 'update_task_status':
return this.updateTaskStatus(args);
case 'create_session':
return this.createSession(args);
case 'get_active_sessions':
return this.getActiveSessions(args);
case 'link_document':
return this.linkDocument(args);
case 'get_kanban_board':
return this.getKanbanBoard(args);
case 'get_project_hierarchy':
return this.getProjectHierarchy(args);
case 'get_project_stats':
return this.getProjectStats(args);
case 'search_tasks':
return this.searchTasks(args);
default:
throw new Error(`Unknown tool: ${name}`);
}
}
createProject(args) {
const project = this.db.createProject(args.name, args.description, args.sessionId);
this.broadcast('project_created', project);
return {
project,
message: `Created project: ${project.name}
Next steps:
- Create workspace: create_workspace("${project.id}", {...})
- Create session: create_session("${project.id}", {...})`,
};
}
listProjects() {
const projects = this.db.getAllProjects();
return {
projects,
message: `Found ${projects.length} project(s)`,
};
}
createWorkspace(args) {
const workspace = this.db.createWorkspace(args.projectId, args);
this.broadcast('workspace_created', workspace);
return {
workspace,
message: `Created workspace: ${workspace.name}
Next steps:
- Add goals: create_goal("${workspace.id}", {...})`,
};
}
createGoal(args) {
const goalData = {
...args,
targetDate: args.targetDate ? new Date(args.targetDate) : undefined,
};
const goal = this.db.createGoal(args.workspaceId, goalData);
this.broadcast('goal_created', goal);
return {
goal,
message: `Created goal: ${goal.title} [${goal.priority}]
Next steps:
- Add tasks: create_task("${goal.id}", {...})`,
};
}
createTask(args) {
const taskData = {
...args,
dueDate: args.dueDate ? new Date(args.dueDate) : undefined,
};
const task = this.db.createTask(args.goalId, taskData);
this.broadcast('task_created', task);
return {
task,
message: `Created task: ${task.title} [${task.status}]
Next steps:
- Update status: update_task_status("${task.id}", "in_progress")
- Add subtasks: create_task(goalId, {parentTaskId: "${task.id}", ...})`,
};
}
updateTaskStatus(args) {
this.db.updateTaskStatus(args.taskId, args.status);
const task = this.db.getTask(args.taskId);
this.broadcast('task_updated', task);
return {
success: true,
task,
message: `Updated task status to: ${args.status}`,
};
}
createSession(args) {
const session = this.db.createSession(args.projectId, args);
this.broadcast('session_created', session);
return {
session,
message: `Created session: ${session.name} [${session.type}]`,
};
}
getActiveSessions(args) {
const sessions = this.db.getActiveSessions(args.projectId);
return {
sessions,
message: `Found ${sessions.length} active session(s)`,
};
}
linkDocument(args) {
// Document linking logic
return {
success: true,
message: `Document linked to ${args.entityType}: ${args.document.title}`,
};
}
getKanbanBoard(args) {
const board = this.db.getKanbanBoard(args.projectId);
return {
projectId: args.projectId,
board,
stats: {
backlog: board.backlog.length,
todo: board.todo.length,
in_progress: board.in_progress.length,
review: board.review.length,
done: board.done.length,
blocked: board.blocked.length,
},
};
}
getProjectHierarchy(args) {
const project = this.db.getProject(args.projectId);
if (!project)
return null;
return {
project,
stats: this.db.getProjectStats(args.projectId),
};
}
getProjectStats(args) {
return this.db.getProjectStats(args.projectId);
}
searchTasks(args) {
// Search logic implementation
return {
results: [],
message: 'Search functionality to be implemented',
};
}
broadcast(event, data) {
this.io.emit(event, data);
}
}
//# sourceMappingURL=index.js.map