MCP Server
Classes
Classes
ToolLimitError
Validation error for tool limit violations
Constructor
constructor(message: string)
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
message | string | Yes |
TaskExecutionEngine
Task Execution Engine Manages the complete lifecycle of task execution
Constructor
constructor(client: IRxDBClient, logger: LoggingService)
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
client | IRxDBClient | Yes | |
logger | LoggingService | Yes |
Methods
prepareTask
Prepare task for execution Validates task exists and retrieves necessary details
prepareTask(context: TaskExecutionContext): Promise<TaskPreparationResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
context | TaskExecutionContext | Yes |
Returns:
Promise<TaskPreparationResult> -
updateTaskMarkdownStatus
Update task markdown status Updates Task.metadata.markdownStatus field to reflect execution state
updateTaskMarkdownStatus(taskId: string, markdownStatus: "[ ]" | "[-]" | "[x]"): Promise<void>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
taskId | string | Yes | |
markdownStatus | "[ ]" | "[-]" | "[x]" | Yes |
Returns:
Promise<void> -
startExecution
Start task execution Updates task status and logs execution start
startExecution(context: TaskExecutionContext): Promise<string>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
context | TaskExecutionContext | Yes |
Returns:
Promise<string> -
completeExecution
Complete task execution Updates task as completed and logs completion
completeExecution(context: TaskExecutionContext, duration: number): Promise<string>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
context | TaskExecutionContext | Yes | |
duration | number | Yes |
Returns:
Promise<string> -
handleExecutionError
Handle task execution error Updates task metadata and logs error
handleExecutionError(context: TaskExecutionContext, error: Error): Promise<string>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
context | TaskExecutionContext | Yes | |
error | Error | Yes |
Returns:
Promise<string> -
executeTask
Execute a task through its full lifecycle This is the main entry point for task execution
executeTask(context: TaskExecutionContext): Promise<void>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
context | TaskExecutionContext | Yes |
Returns:
Promise<void> -
LoggingService
Logging Service Handles all logging operations with structured metadata support
Constructor
constructor(client: IRxDBClient, userId: string, orgId: string)
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
client | IRxDBClient | Yes | |
userId | string | Yes | |
orgId | string | Yes |
Methods
withAgent
Create a new logger instance with agent context
withAgent(agentId: string, agentName: string): LoggingService
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
agentId | string | Yes | |
agentName | string | Yes |
Returns:
LoggingService -
debug
Log debug message
debug(message: string, entityType: EntityType, entityId: string, category?: LogCategory, metadata?: Record<string, any>, parentLogId?: string | undefined): Promise<string>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
message | string | Yes | |
entityType | EntityType | Yes | |
entityId | string | Yes | |
category | LogCategory | No | |
metadata | Record<string, any> | No | |
parentLogId | string | undefined | No |
Returns:
Promise<string> -
info
Log info message
info(message: string, entityType: EntityType, entityId: string, category?: LogCategory, metadata?: Record<string, any>, parentLogId?: string | undefined): Promise<string>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
message | string | Yes | |
entityType | EntityType | Yes | |
entityId | string | Yes | |
category | LogCategory | No | |
metadata | Record<string, any> | No | |
parentLogId | string | undefined | No |
Returns:
Promise<string> -
warn
Log warning message
warn(message: string, entityType: EntityType, entityId: string, category?: LogCategory, metadata?: Record<string, any>, parentLogId?: string | undefined): Promise<string>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
message | string | Yes | |
entityType | EntityType | Yes | |
entityId | string | Yes | |
category | LogCategory | No | |
metadata | Record<string, any> | No | |
parentLogId | string | undefined | No |
Returns:
Promise<string> -
error
Log error message
error(message: string, entityType: EntityType, entityId: string, category?: LogCategory, metadata?: Record<string, any>, parentLogId?: string | undefined): Promise<string>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
message | string | Yes | |
entityType | EntityType | Yes | |
entityId | string | Yes | |
category | LogCategory | No | |
metadata | Record<string, any> | No | |
parentLogId | string | undefined | No |
Returns:
Promise<string> -
critical
Log critical message
critical(message: string, entityType: EntityType, entityId: string, category?: LogCategory, metadata?: Record<string, any>, parentLogId?: string | undefined): Promise<string>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
message | string | Yes | |
entityType | EntityType | Yes | |
entityId | string | Yes | |
category | LogCategory | No | |
metadata | Record<string, any> | No | |
parentLogId | string | undefined | No |
Returns:
Promise<string> -
logTaskStart
Log task execution start
logTaskStart(taskId: string, taskTitle: string, agentId?: string | undefined): Promise<string>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
taskId | string | Yes | |
taskTitle | string | Yes | |
agentId | string | undefined | No |
Returns:
Promise<string> -
logTaskComplete
Log task execution completion
logTaskComplete(taskId: string, taskTitle: string, duration: number): Promise<string>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
taskId | string | Yes | |
taskTitle | string | Yes | |
duration | number | Yes |
Returns:
Promise<string> -
logTaskError
Log task execution error
logTaskError(taskId: string, taskTitle: string, error: Error): Promise<string>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
taskId | string | Yes | |
taskTitle | string | Yes | |
error | Error | Yes |
Returns:
Promise<string> -
getLogsForEntity
Get logs for a specific entity
getLogsForEntity(entityType: EntityType, entityId: string): Promise<LogModel[]>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
entityType | EntityType | Yes | |
entityId | string | Yes |
Returns:
Promise<LogModel[]> -
getLogsByLevel
Get logs by level
getLogsByLevel(level: LogLevel): Promise<LogModel[]>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
level | LogLevel | Yes |
Returns:
Promise<LogModel[]> -
getLogsByCategory
Get logs by category
getLogsByCategory(category: LogCategory): Promise<LogModel[]>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
category | LogCategory | Yes |
Returns:
Promise<LogModel[]> -
getRecentLogs
Get recent logs with limit
getRecentLogs(limit?: number): Promise<LogModel[]>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
limit | number | No |
Returns:
Promise<LogModel[]> -
getLogThread
Get log thread (parent and all children)
getLogThread(parentLogId: string): Promise<LogModel[]>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
parentLogId | string | Yes |
Returns:
Promise<LogModel[]> -
ApprovalManager
ApprovalManager - Handles approval lifecycle operations
Constructor
constructor(client: IRxDBClient, logger: LoggingService)
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
client | IRxDBClient | Yes | |
logger | LoggingService | Yes |
Methods
createApproval
Create a new approval with pending status
Validates all required inputs, generates unique ID, initializes with pending status, persists to RxDB, and logs the creation.
createApproval(data: CreateApprovalData): Promise<{ success: boolean; approvalId?: string; message?: string; }>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
data | CreateApprovalData | Yes | - Approval creation data |
Returns:
Promise<{ success: boolean; approvalId?: string; message?: string; }> - Promise resolving to result object with success flag and approval ID
updateApprovalStatus
Update approval status with state machine validation
Validates status transitions according to the approval workflow state machine, updates the approval document using RxDB patch, and logs the transition.
State Machine Rules:
- pending → approved, rejected, needs-revision, pending (idempotent)
- approved → approved (idempotent only)
- rejected → rejected (idempotent only)
- needs-revision → approved, rejected, needs-revision (idempotent)
- Invalid: Any terminal state (approved, rejected) cannot transition to other states
- Invalid: needs-revision cannot transition back to pending
updateApprovalStatus(approvalId: string, status: "pending" | "approved" | "rejected" | "needs-revision", response?: string | undefined): Promise<void>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
approvalId | string | Yes | - ID of the approval to update |
status | "pending" | "approved" | "rejected" | "needs-revision" | Yes | - New status to set |
response | string | undefined | No | - Optional response message from approver |
Returns:
Promise<void> - Promise that resolves when update is complete
Examples:
// Approve a pending approval
await manager.updateApprovalStatus('approval_123', 'approved', 'Looks good!');
// Reject with feedback
await manager.updateApprovalStatus('approval_456', 'rejected', 'Missing requirements');
// Request revisions
await manager.updateApprovalStatus('approval_789', 'needs-revision', 'Please add section 3');
getApproval
Retrieve an approval by ID
getApproval(approvalId: string): Promise<any>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
approvalId | string | Yes | - ID of the approval to retrieve |
Returns:
Promise<any> - Promise resolving to the approval document or null if not found
Examples:
const approval = await manager.getApproval('approval_123');
if (approval) {
console.log(`Approval status: ${approval.status}`);
}
deleteApproval
Delete an approval by ID
deleteApproval(approvalId: string): Promise<{ success: boolean; message?: string; }>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
approvalId | string | Yes | - ID of the approval to delete |
Returns:
Promise<{ success: boolean; message?: string; }> - Promise resolving to result object with success flag
Examples:
const result = await manager.deleteApproval('approval_123');
console.log(result.success ? 'Deleted' : 'Not found');
addComment
Add a comment to an approval
Supports both general comments and selection-based comments with context.
addComment(approvalId: string, comment: { [key: string]: any; text?: string; selection?: string; position?: { line: number; column: number; }; }): Promise<void>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
approvalId | string | Yes | - ID of the approval to comment on |
comment | { [key: string]: any; text?: string; selection?: string; position?: { line: number; column: number; }; } | Yes | - Comment to add (general or selection-based) |
Returns:
Promise<void> - Promise that resolves when comment is added
Examples:
// Add general comment
await manager.addComment('approval_123', {
type: 'general',
comment: 'Looks good overall'
});
// Add selection comment
await manager.addComment('approval_456', {
type: 'selection',
comment: 'This needs clarification',
selectedText: 'Authentication flow',
position: 42
});
listApprovals
List approvals with optional filters
Query approvals by status, project, or organization. Combine filters for more specific results.
listApprovals(filters: ApprovalFilters): Promise<any[]>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
filters | ApprovalFilters | Yes | - Optional filters for status, projectId, orgId |
Returns:
Promise<any[]> - Promise resolving to array of approval documents
Examples:
// List all pending approvals for a project
const pending = await manager.listApprovals({
status: 'pending',
projectId: 'proj_123'
});
// List all approvals for an organization
const orgApprovals = await manager.listApprovals({
orgId: 'org_456'
});
Examples:
const manager = new ApprovalManager(rxdbClient, logger);
const approvalId = await manager.createApproval({
projectId: 'proj_123',
title: 'Requirements Document Review',
type: 'document',
category: 'spec',
categoryName: 'auth-feature',
documentType: 'requirements',
orgId: 'org_123',
userId: 'user_123'
});
console.log(`Created approval: ${approvalId}`);
BaseManager
Base class for all manager classes providing common functionality for database operations and error handling.
Constructor
constructor(client: IRxDBClient, logger: LoggingService)
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
client | IRxDBClient | Yes | |
logger | LoggingService | Yes |
Properties
| Property | Type | Required | Description |
|---|---|---|---|
client | IRxDBClient | Yes | |
logger | LoggingService | Yes |
Methods
ensureConnected
Ensures the RxDB client is connected before performing operations. Returns an error result if not connected, undefined if connected.
ensureConnected(): T | undefined
Returns:
T \| undefined - Error result if not connected, undefined if connected
isClientConnected
Checks if the RxDB client is currently connected.
isClientConnected(): boolean
Returns:
boolean - True if connected, false otherwise
extractErrorMessage
Extracts a user-friendly error message from an unknown error object.
extractErrorMessage(error: unknown): string
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
error | unknown | Yes | - The error object to extract a message from |
Returns:
string - The error message string
CodebaseManager
CodebaseManager - Handles codebase lifecycle operations
This manager follows the standard Epic Flow manager pattern with:
- Constructor injection of RxDBClient and LoggingService
- Comprehensive validation and error handling
- Structured result objects for all operations
- Detailed logging for observability
Constructor
constructor(client: IRxDBClient, logger: LoggingService)
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
client | IRxDBClient | Yes | |
logger | LoggingService | Yes |
Methods
createCodebase
Create a new codebase with active status
This method performs the following operations in sequence:
- Validates database connection
- Validates required fields (top-level and nested)
- Validates Git URL format (HTTPS or SSH)
- Validates workspace exists and is not archived
- Validates enum values (provider, packageManager)
- Sanitizes codebase name to kebab-case
- Checks for duplicate names within workspace
- Generates unique codebase ID
- Builds and persists codebase document
- Logs success/failure
createCodebase(data: CreateCodebaseData): Promise<CreateCodebaseResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
data | CreateCodebaseData | Yes | - Codebase creation data with required fields and nested repository/environment configuration |
Returns:
Promise<CreateCodebaseResult> - Promise resolving to result object containing success flag, optional codebaseId, and message
Examples:
const result = await manager.createCodebase({
name: 'Frontend App',
title: 'Frontend Application',
description: 'Main frontend codebase',
workspaceId: 'workspace_123',
repository: {
url: 'git@github.com:org/frontend.git',
defaultBranch: 'main',
provider: 'github',
privateRepo: true,
accessToken: 'token_123'
},
environment: {
nodeVersion: '20.x',
packageManager: 'pnpm',
workingDirectory: './app',
setupCommands: ['pnpm install'],
buildCommands: ['pnpm build'],
environmentVariables: { NODE_ENV: 'production' }
},
tags: ['react', 'typescript'],
orgId: 'org_123',
userId: 'user_456'
});
getCodebase
Retrieve a codebase by ID
Queries the database for a codebase with the specified ID and returns the document if found, or null if no codebase exists with that ID. Returns null if the client is not connected or if a database error occurs.
getCodebase(codebaseId: string): Promise<any>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
codebaseId | string | Yes | - Unique identifier of the codebase to retrieve |
Returns:
Promise<any> - Promise resolving to codebase document or null if not found
Examples:
const codebase = await manager.getCodebase('codebase_1234567890_abc123');
if (codebase) {
console.log(`Found codebase: ${codebase.title}`);
} else {
console.log('Codebase not found');
}
listCodebases
List codebases with optional filters
Query codebases by status, workspaceId, orgId, or name. Combine filters for more specific results. Returns an empty array if no codebases match the filters, if the client is not connected, or if a database error occurs.
listCodebases(filters: CodebaseFilters): Promise<any[]>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
filters | CodebaseFilters | Yes | - Optional filters for status, workspaceId, orgId, name |
Returns:
Promise<any[]> - Promise resolving to array of codebase documents
Examples:
// List all active codebases in a workspace
const activeCodebases = await manager.listCodebases({
status: 'active',
workspaceId: 'workspace_123'
});
// List codebases by name
const codebase = await manager.listCodebases({
name: 'frontend-app'
});
updateCodebase
Update a codebase
Updates one or more fields of an existing codebase using RxDB's atomicUpdate for efficient updates. Automatically updates the updatedAt timestamp. Only fields that are explicitly provided in the updates parameter will be modified. Supports partial updates for nested objects (repository, environment, deployment, agentWorkflow).
updateCodebase(codebaseId: string, updates: UpdateCodebaseData, userId: string): Promise<UpdateCodebaseResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
codebaseId | string | Yes | - ID of the codebase to update |
updates | UpdateCodebaseData | Yes | - Fields to update (title, description, repository, environment, deployment, agentWorkflow, tags, metadata) |
userId | string | Yes | - ID of the user performing the update |
Returns:
Promise<UpdateCodebaseResult> - Promise resolving to result object with success flag and message
Examples:
const result = await manager.updateCodebase(
'codebase_123',
{
title: 'Updated Title',
repository: {
defaultBranch: 'develop'
},
tags: ['frontend', 'react']
},
'user_456'
);
if (result.success) {
console.log('Codebase updated successfully');
}
archiveCodebase
Archive a codebase
Sets the codebase status to 'archived' and records the archivedAt timestamp. Archived codebases are not deleted but are marked as inactive. The operation is idempotent - archiving an already archived codebase succeeds without error.
archiveCodebase(codebaseId: string, userId: string): Promise<ArchiveCodebaseResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
codebaseId | string | Yes | - ID of the codebase to archive |
userId | string | Yes | - ID of the user performing the archive operation |
Returns:
Promise<ArchiveCodebaseResult> - Promise resolving to result object with success flag and message
Examples:
const result = await manager.archiveCodebase('codebase_123', 'user_456');
if (result.success) {
console.log('Codebase archived successfully');
}
validateCodebase
Validate codebase configuration
Performs comprehensive validation of codebase creation data without actually creating the codebase. Returns a structured ValidationResult with all issues found, allowing clients to check configuration validity before attempting creation.
Validation checks:
- Required fields (name, title, description, workspaceId, orgId, userId)
- Repository configuration (url format, defaultBranch, provider enum, privateRepo)
- Environment configuration (packageManager enum, setupCommands array)
- Optional but recommended fields (warnings for missing organization, repositoryName, etc.)
validateCodebase(data: CreateCodebaseData): Promise<ValidationResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
data | CreateCodebaseData | Yes | - Codebase configuration data to validate |
Returns:
Promise<ValidationResult> - Promise resolving to ValidationResult with success, valid flag, issues array, and message
Examples:
const result = await manager.validateCodebase({
name: 'my-app',
title: 'My App',
description: 'My application',
workspaceId: 'workspace_123',
repository: {
url: 'https://github.com/org/repo.git',
defaultBranch: 'main',
provider: 'github',
privateRepo: true
},
environment: {
packageManager: 'yarn',
setupCommands: ['yarn install']
},
orgId: 'org_123',
userId: 'user_456'
});
if (result.valid) {
console.log('Configuration is valid');
} else {
console.log('Validation errors:', result.issues.filter(i => i.severity === 'error'));
}
Examples:
const manager = new CodebaseManager(rxdbClient, logger);
const result = await manager.createCodebase({
name: 'My Codebase',
title: 'My Awesome Codebase',
description: 'A codebase for awesome projects',
workspaceId: 'workspace_123',
repository: {
url: 'https://github.com/org/repo.git',
defaultBranch: 'main',
provider: 'github',
privateRepo: true
},
environment: {
packageManager: 'yarn',
setupCommands: ['yarn install', 'yarn build']
},
orgId: 'org_123',
userId: 'user_123'
});
if (result.success) {
console.log(`Created codebase: ${result.codebaseId}`);
}
DiscussionManager
Discussion Manager
Manages conversation turns as Discussion documents linked to tasks. Supports conversation history, threading, and metadata tracking.
Constructor
constructor(client: IRxDBClient, logger: LoggingService, orgId: string, workspaceId: string, userId: string)
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
client | IRxDBClient | Yes | |
logger | LoggingService | Yes | |
orgId | string | Yes | |
workspaceId | string | Yes | |
userId | string | Yes |
Methods
createTurn
Create a new discussion (conversation turn)
createTurn(params: { entityType: "task"; entityId: string; content: string; role: "user" | "assistant" | "system"; turnNumber: number; userName: string; metadata?: Record<string, any>; }): Promise<DiscussionModel>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
params | { entityType: "task"; entityId: string; content: string; role: "user" | "assistant" | "system"; turnNumber: number; userName: string; metadata?: Record<string, any>; } | Yes |
Returns:
Promise<DiscussionModel> -
getTaskConversation
Get all conversation turns for a task
getTaskConversation(taskId: string, options?: { includeDeleted?: boolean; } | undefined): Promise<DiscussionModel[]>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
taskId | string | Yes | |
options | { includeDeleted?: boolean; } | undefined | No |
Returns:
Promise<DiscussionModel[]> -
updateTurn
Update discussion content (marks as edited)
updateTurn(discussionId: string, content: string): Promise<DiscussionModel>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
discussionId | string | Yes | |
content | string | Yes |
Returns:
Promise<DiscussionModel> -
deleteTurn
Soft delete a discussion turn
deleteTurn(discussionId: string): Promise<DiscussionModel>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
discussionId | string | Yes |
Returns:
Promise<DiscussionModel> -
getConversationStats
Get conversation statistics
getConversationStats(taskId: string): Promise<{ totalTurns: number; userTurns: number; assistantTurns: number; totalTokens: number; totalCost: number; }>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
taskId | string | Yes |
Returns:
Promise<{ totalTurns: number; userTurns: number; assistantTurns: number; totalTokens: number; totalCost: number; }> -
SteeringManager
SteeringManager - Handles steering document retrieval with scope filtering
Constructor
constructor(client: IRxDBClient, logger: LoggingService, _userId?: string | undefined, orgId?: string | undefined)
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
client | IRxDBClient | Yes | |
logger | LoggingService | Yes | |
_userId | string | undefined | No | |
orgId | string | undefined | No |
Methods
getSteeringDoc
Retrieve a steering document by type with scope filtering
Scoping Resolution Priority:
- Project-specific document (if projectId provided and document exists)
- Organization-level document (fallback, accessible to all projects)
- null (if no document found)
Organization-level documents (no projectId) serve as defaults accessible to all projects in the organization. Project-specific documents override org-level documents for that specific project.
getSteeringDoc(documentType: SteeringType, orgId: string, projectId?: string | undefined): Promise<any>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
documentType | SteeringType | Yes | - Type of steering document (product/tech/structure) |
orgId | string | Yes | - Organization ID |
projectId | string | undefined | No | - Optional project ID for project-specific documents |
Returns:
Promise<any> - Promise resolving to the steering document or null if not found
Examples:
// Get project-specific tech document (or org fallback)
const projectTech = await manager.getSteeringDoc('tech', 'org_123', 'project_456');
// Get org-level product document
const orgProduct = await manager.getSteeringDoc('product', 'org_123');
// Handle not found
const doc = await manager.getSteeringDoc('structure', 'org_789', 'project_999');
if (!doc) {
console.log('No steering document found');
}
createSteeringDoc
Create a new steering document
Creates a steering document at org-level (no projectId) or project-level (with projectId). Org-level documents are accessible to all projects in the organization. Project-level documents override org-level for that specific project.
createSteeringDoc(data: CreateSteeringData): Promise<string>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
data | CreateSteeringData | Yes | - Steering document creation data |
Returns:
Promise<string> - Promise resolving to the generated document ID
Examples:
// Create org-level document (accessible to all projects)
const orgDocId = await manager.createSteeringDoc({
documentType: 'product',
title: 'Product Vision',
content: '# Product Vision\n\n...',
orgId: 'org_123',
userId: 'user_456'
});
// Create project-level document (overrides org-level for this project)
const projectDocId = await manager.createSteeringDoc({
documentType: 'tech',
title: 'Project Tech Stack',
content: '# Tech Stack\n\n...',
orgId: 'org_123',
projectId: 'project_789',
userId: 'user_456'
});
updateSteeringDoc
Update steering document content
Updates content and increments version number. Preserves all other fields including approval status, which must be updated separately if document needs re-approval.
updateSteeringDoc(documentId: string, content: string): Promise<void>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
documentId | string | Yes | - ID of the steering document to update |
content | string | Yes | - New document content |
Returns:
Promise<void> - Promise that resolves when update is complete
Examples:
await manager.updateSteeringDoc(
'steering_product_org123_abc',
'# Updated Product Vision\n\n[New content]'
);
console.log('Steering document updated');
listSteeringDocs
List steering documents with optional organization and project filtering
Retrieves steering documents filtered by scope. When scope is 'org', returns only org-level documents using the orgId from the constructor. When scope is 'project', returns BOTH project-specific and org-level documents.
listSteeringDocs(options: ListSteeringDocsOptions): Promise<{ success: boolean; documents?: any[]; message?: string; }>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
options | ListSteeringDocsOptions | Yes | - Listing options with scope and optional projectId |
Returns:
Promise<{ success: boolean; documents?: any[]; message?: string; }> - Promise resolving to result object with success flag and documents array
Examples:
// List all org-level documents
const result = await manager.listSteeringDocs({ scope: 'org' });
console.log(`Found ${result.documents?.length} documents`);
// List project-specific + org-level documents
const projectResult = await manager.listSteeringDocs({
scope: 'project',
projectId: 'project_456'
});
Examples:
const manager = new SteeringManager(rxdbClient, logger);
// Get project-specific document (or org-level fallback)
const doc = await manager.getSteeringDoc('product', 'org_123', 'project_456');
// Get org-level document (accessible to all projects)
const orgDoc = await manager.getSteeringDoc('tech', 'org_123');
console.log(`Document: ${doc?.title}`);
TemplateManager
TemplateManager - Handles template retrieval with org-level customization
Constructor
constructor(client: IRxDBClient, logger: LoggingService)
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
client | IRxDBClient | Yes | |
logger | LoggingService | Yes |
Methods
getTemplate
Retrieve a template by type with org-specific customization
Template Resolution Priority:
- Org-specific custom template (if orgId provided)
- System default template
- null (if no template found)
getTemplate(templateType: TemplateType, orgId?: string | undefined): Promise<any>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
templateType | TemplateType | Yes | - Type of template to retrieve |
orgId | string | undefined | No | - Optional organization ID for custom templates |
Returns:
Promise<any> - Promise resolving to the template document or null if not found
Examples:
// Get org-specific template
const customTemplate = await manager.getTemplate('requirements', 'org_123');
// Get default template
const defaultTemplate = await manager.getTemplate('design');
// Handle not found
const template = await manager.getTemplate('tasks', 'org_456');
if (!template) {
console.log('No template found');
}
initializeDefaultTemplates
Initialize default system templates (idempotent)
Creates system default templates for all template types if they don't already exist. This method is safe to call multiple times - it only creates templates that are missing.
initializeDefaultTemplates(): Promise<void>
Returns:
Promise<void> - Promise that resolves when initialization is complete
Examples:
// Initialize defaults on server startup
await manager.initializeDefaultTemplates();
console.log('Default templates initialized');
createTemplate
Create a new custom template
Creates a custom template for an organization. Custom templates take priority over system defaults when retrieved with getTemplate().
createTemplate(data: CreateTemplateData): Promise<{ success: boolean; templateId?: string; message?: string; }>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
data | CreateTemplateData | Yes | - Template creation data |
Returns:
Promise<{ success: boolean; templateId?: string; message?: string; }> - Promise resolving to the generated template ID
Examples:
const templateId = await manager.createTemplate({
templateType: 'requirements',
name: 'Custom Requirements Template',
content: '# Requirements\\n\\n[Custom structure]',
orgId: 'org_123',
userId: 'user_456',
description: 'Our company requirements format'
});
console.log(`Created template: ${templateId}`);
updateTemplate
Update an existing template's content
Updates template content and increments version. Only custom templates can be updated; system default templates are immutable.
updateTemplate(templateId: string, content: string): Promise<void>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
templateId | string | Yes | - ID of the template to update |
content | string | Yes | - New template content |
Returns:
Promise<void> - Promise that resolves when update is complete
Examples:
await manager.updateTemplate(
'template_requirements_org123_abc',
'# Updated Requirements\\n\\n[New structure]'
);
console.log('Template updated');
listTemplates
List templates with optional organization filter
Retrieves all templates, optionally filtered by organization. If orgId is provided, returns both org-specific custom templates and system defaults. If no orgId provided, returns only system default templates.
listTemplates(orgId?: string | undefined): Promise<{ success: boolean; templates?: TemplateDocument[]; message?: string; }>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
orgId | string | undefined | No | - Optional organization ID to filter by |
Returns:
Promise<{ success: boolean; templates?: TemplateDocument[]; message?: string; }> - Promise resolving to result object with success flag and templates array
Examples:
// List all templates for an organization (custom + defaults)
const result = await manager.listTemplates('org_123');
console.log(`Found ${result.templates?.length} templates`);
// List only system default templates
const defaults = await manager.listTemplates();
Examples:
const manager = new TemplateManager(rxdbClient);
// Get org-specific template with fallback to default
const template = await manager.getTemplate('requirements', 'org_123');
// Get default template (no orgId provided)
const defaultTemplate = await manager.getTemplate('design');
console.log(`Template: ${template?.name}`);
WorkspaceManager
WorkspaceManager - Handles workspace lifecycle operations
This manager follows the standard Epic Flow manager pattern with:
- Constructor injection of RxDBClient and LoggingService
- Comprehensive validation and error handling
- Structured result objects for all operations
- Detailed logging for observability
Constructor
constructor(client: IRxDBClient, logger: LoggingService)
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
client | IRxDBClient | Yes | |
logger | LoggingService | Yes |
Methods
createWorkspace
Create a new workspace with active status
This method performs the following operations in sequence:
- Validates database connection
- Validates required fields
- Sanitizes workspace name to kebab-case
- Checks for duplicate names within organization
- Generates unique workspace ID
- Builds and persists workspace document
- Logs success/failure
createWorkspace(data: CreateWorkspaceData): Promise<CreateWorkspaceResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
data | CreateWorkspaceData | Yes | - Workspace creation data with required fields (name, title, description, orgId, userId) and optional fields (tags, metadata) |
Returns:
Promise<CreateWorkspaceResult> - Promise resolving to result object containing success flag, optional workspaceId, and message
Examples:
const result = await manager.createWorkspace({
name: 'Frontend Team',
title: 'Frontend Development Workspace',
description: 'Workspace for all frontend projects',
tags: ['react', 'typescript'],
metadata: { primaryLanguage: 'typescript' },
orgId: 'org_123',
userId: 'user_456'
});
getWorkspace
Retrieve a workspace by ID
Queries the database for a workspace with the specified ID and returns the document if found, or null if no workspace exists with that ID. Returns null if the client is not connected or if a database error occurs.
getWorkspace(workspaceId: string): Promise<any>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
workspaceId | string | Yes | - Unique identifier of the workspace to retrieve |
Returns:
Promise<any> - Promise resolving to workspace document or null if not found
Examples:
const workspace = await manager.getWorkspace('workspace_1234567890_abc123');
if (workspace) {
console.log(`Found workspace: ${workspace.title}`);
} else {
console.log('Workspace not found');
}
listWorkspaces
List workspaces with optional filters
Query workspaces by status, orgId, or name. Combine filters for more specific results. Returns an empty array if no workspaces match the filters, if the client is not connected, or if a database error occurs.
listWorkspaces(filters: WorkspaceFilters): Promise<any[]>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
filters | WorkspaceFilters | Yes | - Optional filters for status, orgId, name |
Returns:
Promise<any[]> - Promise resolving to array of workspace documents
Examples:
// List all active workspaces in an organization
const activeWorkspaces = await manager.listWorkspaces({
status: 'active',
orgId: 'org_123'
});
// List workspaces by name
const workspace = await manager.listWorkspaces({
name: 'frontend-team'
});
updateWorkspace
Update a workspace
Updates one or more fields of an existing workspace using RxDB's atomicPatch for efficient updates. Automatically updates the updatedAt timestamp. Only fields that are explicitly provided in the updates parameter will be modified.
updateWorkspace(workspaceId: string, updates: UpdateWorkspaceData, userId: string): Promise<UpdateWorkspaceResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
workspaceId | string | Yes | - ID of the workspace to update |
updates | UpdateWorkspaceData | Yes | - Fields to update (title, description, tags, metadata) |
userId | string | Yes | - ID of the user performing the update |
Returns:
Promise<UpdateWorkspaceResult> - Promise resolving to result object with success flag and message
Examples:
const result = await manager.updateWorkspace(
'workspace_123',
{
title: 'Updated Title',
tags: ['frontend', 'react']
},
'user_456'
);
if (result.success) {
console.log('Workspace updated successfully');
}
archiveWorkspace
Archive a workspace
Sets the workspace status to 'archived' and records the archivedAt timestamp. Archived workspaces are not deleted but are marked as inactive. The operation is idempotent - archiving an already archived workspace succeeds without error.
archiveWorkspace(workspaceId: string, userId: string): Promise<ArchiveWorkspaceResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
workspaceId | string | Yes | - ID of the workspace to archive |
userId | string | Yes | - ID of the user performing the archive operation |
Returns:
Promise<ArchiveWorkspaceResult> - Promise resolving to result object with success flag and message
Examples:
const result = await manager.archiveWorkspace('workspace_123', 'user_456');
if (result.success) {
console.log('Workspace archived successfully');
}
Examples:
const manager = new WorkspaceManager(rxdbClient, logger);
const result = await manager.createWorkspace({
name: 'My Workspace',
title: 'My Awesome Workspace',
description: 'A workspace for awesome projects',
orgId: 'org_123',
userId: 'user_123'
});
if (result.success) {
console.log(`Created workspace: ${result.workspaceId}`);
}
FlowStateMCPServer
FlowState MCP Server Handles MCP protocol communication and tool execution
Constructor
constructor(config: MCPServerConfig)
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
config | MCPServerConfig | Yes |
Methods
initialize
Initialize the server and all dependencies
initialize(): Promise<void>
Returns:
Promise<void> -
executeTool
Execute a tool programmatically (for testing)
executeTool(name: string, args: any): Promise<any>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | |
args | any | Yes |
Returns:
Promise<any> -
isInitialized
Check if server is initialized
isInitialized(): boolean
Returns:
boolean -
getClient
Get the RxDB client
getClient(): IRxDBClient
Returns:
IRxDBClient -
getLogger
Get the logging service
getLogger(): LoggingService
Returns:
LoggingService -
getRegisteredTools
Get list of registered tools
getRegisteredTools(): string[]
Returns:
string[] -
getToolDefinitions
Get full tool definitions with descriptions and input schemas Used by HTTP server to expose tools with proper metadata
getToolDefinitions(): { name: string; description: string; inputSchema: any; }[]
Returns:
{ name: string; description: string; inputSchema: any; }[] -
updateAuthToken
Update the auth token used for RxDB operations This allows per-request auth token updates for user context
updateAuthToken(authToken: string): Promise<void>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
authToken | string | Yes |
Returns:
Promise<void> -
updateConfig
Update server configuration before or after initialization Useful for setting domain/org/user from request context Also updates the underlying RxDB client's auth token if initialized
updateConfig(updates: Partial<MCPServerConfig>): void
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
updates | Partial<MCPServerConfig> | Yes |
createServerForSession
Create a fresh MCP SDK Server instance for an HTTP transport session. Each session needs its own Server since the SDK Server can only connect to one transport at a time. All sessions share the same initialized tool handlers and DB connections via handleToolCall().
createServerForSession(): Server<{ method: string; params?: { [x: string]: unknown; _meta?: { [x: string]: unknown; progressToken?: string | number | undefined; "io.modelcontextprotocol/related-task"?: { taskId: string; } | undefined; } | undefined; } | undefined; }, { method: string; params?: { [x: string]: unknown; _meta?: { [x: string]: unknown; progressToken?: string | number | undefined; "io.modelcontextprotocol/related-task"?: { taskId: string; } | undefined; } | undefined; } | undefined; }, { [x: string]: unknown; _meta?: { [x: string]: unknown; progressToken?: string | number | undefined; "io.modelcontextprotocol/related-task"?: { taskId: string; } | undefined; } | undefined; }>
Returns:
Server<{ method: string; params?: { [x: string]: unknown; _meta?: { [x: string]: unknown; progressToken?: string \| number \| undefined; "io.modelcontextprotocol/related-task"?: { taskId: string; } \| undefined; } \| undefined; } \| undefined; }, { method: string; params?: { [x: string]: unknown; _meta?: { [x: string]: unknown; progressToken?: string \| number \| undefined; "io.modelcontextprotocol/related-task"?: { taskId: string; } \| undefined; } \| undefined; } \| undefined; }, { [x: string]: unknown; _meta?: { [x: string]: unknown; progressToken?: string \| number \| undefined; "io.modelcontextprotocol/related-task"?: { taskId: string; } \| undefined; } \| undefined; }> -
close
Close the server and clean up resources
close(): Promise<void>
Returns:
Promise<void> -
AgentTools
Agent Tools Handles agent assignment and coordination
Constructor
constructor(client: IRxDBClient)
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
client | IRxDBClient | Yes |
Methods
assignTaskToAgent
Assign task to agent
Assigns a specific task to an agent with metadata tracking.
assignTaskToAgent(args: { taskId: string; agentId: string; agentType?: "main" | "subagent" | "reviewer" | "specialist"; userId: string; orgId: string; }): Promise<CallToolResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
args | { taskId: string; agentId: string; agentType?: "main" | "subagent" | "reviewer" | "specialist"; userId: string; orgId: string; } | Yes |
Returns:
Promise<CallToolResult> -
getAgentWorkload
Get agent workload
Returns all tasks assigned to a specific agent with status breakdown.
getAgentWorkload(args: { agentId: string; orgId: string; }): Promise<CallToolResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
args | { agentId: string; orgId: string; } | Yes |
Returns:
Promise<CallToolResult> -
claimTask
Claim task
Allows an agent to self-assign a task (first-come-first-served).
claimTask(args: { taskId: string; agentId: string; agentType?: "main" | "subagent" | "reviewer" | "specialist"; userId: string; orgId: string; }): Promise<CallToolResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
args | { taskId: string; agentId: string; agentType?: "main" | "subagent" | "reviewer" | "specialist"; userId: string; orgId: string; } | Yes |
Returns:
Promise<CallToolResult> -
reportAgentProgress
Report agent progress
Updates agent status and progress on assigned tasks.
reportAgentProgress(args: { agentId: string; taskId: string; status: "working" | "paused" | "completed"; progress?: number; notes?: string; userId: string; orgId: string; }): Promise<CallToolResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
args | { agentId: string; taskId: string; status: "working" | "paused" | "completed"; progress?: number; notes?: string; userId: string; orgId: string; } | Yes |
Returns:
Promise<CallToolResult> -
unassignTask
Unassign task
Removes agent assignment from a task.
unassignTask(args: { taskId: string; userId: string; orgId: string; }): Promise<CallToolResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
args | { taskId: string; userId: string; orgId: string; } | Yes |
Returns:
Promise<CallToolResult> -
listAvailableTasks
List available tasks
Finds tasks that are ready to be claimed (no assignment, dependencies met).
listAvailableTasks(args: { projectId: string; orgId: string; }): Promise<CallToolResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
args | { projectId: string; orgId: string; } | Yes |
Returns:
Promise<CallToolResult> -
CodebaseTools
Codebase Tools Handles codebase management operations through MCP interface
Constructor
constructor(client: IRxDBClient, codebaseManager: CodebaseManager, logger: LoggingService)
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
client | IRxDBClient | Yes | |
codebaseManager | CodebaseManager | Yes | |
logger | LoggingService | Yes |
Methods
handleCodebaseCreate
Handle codebase creation
Creates a new codebase with Git repository configuration, development environment, optional deployment settings, and optional agent workflow configuration.
handleCodebaseCreate(args: { name: string; title: string; description: string; workspaceId: string; repository: { url: string; defaultBranch: string; provider: "github" | "gitlab" | "bitbucket" | "other"; organization?: string; repositoryName?: string; privateRepo: boolean; accessToken?: string; sshKey?: string; }; environment: { nodeVersion?: string; packageManager: "npm" | "yarn" | "pnpm" | "bun"; workingDirectory?: string; setupCommands: string[]; testCommands?: string[]; buildCommands?: string[]; environmentVariables?: Record<string, string>; }; deployment?: { platform: "cloudflare" | "digitalocean" | "vercel" | "railway" | "aws" | "custom"; productionUrl?: string; stagingUrl?: string; previewUrlPattern?: string; deployCommand?: string; deployBranch?: string; cicdProvider?: "github-actions" | "gitlab-ci" | "cloudflare-pages" | "custom"; cicdConfigPath?: string; platformConfig?: Record<string, any>; }; agentWorkflow?: { branchStrategy: "feature-per-spec" | "feature-per-task" | "shared-branch"; branchPrefix: string; commitConvention: "conventional" | "simple" | "custom"; commitTemplate?: string; requireTests: boolean; requireLint: boolean; createPR: boolean; prTitleTemplate?: string; prDescriptionTemplate?: string; prReviewers?: string[]; prLabels?: string[]; }; tags?: string[]; metadata?: Record<string, any>; orgId: string; userId: string; }): Promise<CallToolResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
args | { name: string; title: string; description: string; workspaceId: string; repository: { url: string; defaultBranch: string; provider: "github" | "gitlab" | "bitbucket" | "other"; organization?: string; repositoryName?: string; privateRepo: boolean; accessToken?: string; sshKey?: string; }; environment: { nodeVersion?: string; packageManager: "npm" | "yarn" | "pnpm" | "bun"; workingDirectory?: string; setupCommands: string[]; testCommands?: string[]; buildCommands?: string[]; environmentVariables?: Record<string, string>; }; deployment?: { platform: "cloudflare" | "digitalocean" | "vercel" | "railway" | "aws" | "custom"; productionUrl?: string; stagingUrl?: string; previewUrlPattern?: string; deployCommand?: string; deployBranch?: string; cicdProvider?: "github-actions" | "gitlab-ci" | "cloudflare-pages" | "custom"; cicdConfigPath?: string; platformConfig?: Record<string, any>; }; agentWorkflow?: { branchStrategy: "feature-per-spec" | "feature-per-task" | "shared-branch"; branchPrefix: string; commitConvention: "conventional" | "simple" | "custom"; commitTemplate?: string; requireTests: boolean; requireLint: boolean; createPR: boolean; prTitleTemplate?: string; prDescriptionTemplate?: string; prReviewers?: string[]; prLabels?: string[]; }; tags?: string[]; metadata?: Record<string, any>; orgId: string; userId: string; } | Yes | - Codebase creation arguments with nested objects |
Returns:
Promise<CallToolResult> - CallToolResult with codebase creation result
Examples:
const result = await codebaseTools.handleCodebaseCreate({
name: 'my-app',
title: 'My Application',
description: 'Main application codebase',
workspaceId: 'workspace_123',
repository: {
url: 'https://github.com/org/repo.git',
defaultBranch: 'main',
provider: 'github',
privateRepo: true
},
environment: {
packageManager: 'yarn',
setupCommands: ['yarn install', 'yarn build']
},
orgId: 'org_123',
userId: 'user_123'
});
handleCodebaseList
Handle codebase listing
Lists codebases with optional filters for status, workspace, organization, or name. Returns codebase list formatted as JSON.
handleCodebaseList(args: { workspaceId?: string; orgId?: string; status?: "active" | "archived" | "paused"; name?: string; }): Promise<CallToolResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
args | { workspaceId?: string; orgId?: string; status?: "active" | "archived" | "paused"; name?: string; } | Yes | - Codebase listing filters |
Returns:
Promise<CallToolResult> - CallToolResult with codebase list
Examples:
// List all active codebases in a workspace
const result = await codebaseTools.handleCodebaseList({
workspaceId: 'workspace_123',
status: 'active'
});
// List codebases by name
const result = await codebaseTools.handleCodebaseList({
name: 'frontend-app'
});
handleCodebaseGet
Handle codebase retrieval
Retrieves a single codebase by ID with full details including repository, environment, deployment, and agent workflow configuration.
handleCodebaseGet(args: { codebaseId: string; }): Promise<CallToolResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
args | { codebaseId: string; } | Yes | - Codebase retrieval arguments |
Returns:
Promise<CallToolResult> - CallToolResult with codebase details
Examples:
const result = await codebaseTools.handleCodebaseGet({
codebaseId: 'codebase_123'
});
handleCodebaseUpdate
Handle codebase update
Updates one or more fields of an existing codebase. Only provided fields will be updated. Supports partial updates for nested objects (repository, environment, deployment, agentWorkflow).
handleCodebaseUpdate(args: { codebaseId: string; title?: string; description?: string; repository?: Partial<{ url: string; defaultBranch: string; provider: "github" | "gitlab" | "bitbucket" | "other"; organization?: string; repositoryName?: string; privateRepo: boolean; accessToken?: string; sshKey?: string; }>; environment?: Partial<{ nodeVersion?: string; packageManager: "npm" | "yarn" | "pnpm" | "bun"; workingDirectory?: string; setupCommands: string[]; testCommands?: string[]; buildCommands?: string[]; environmentVariables?: Record<string, string>; }>; deployment?: Partial<{ platform: "cloudflare" | "digitalocean" | "vercel" | "railway" | "aws" | "custom"; productionUrl?: string; stagingUrl?: string; previewUrlPattern?: string; deployCommand?: string; deployBranch?: string; cicdProvider?: "github-actions" | "gitlab-ci" | "cloudflare-pages" | "custom"; cicdConfigPath?: string; platformConfig?: Record<string, any>; }>; agentWorkflow?: Partial<{ branchStrategy: "feature-per-spec" | "feature-per-task" | "shared-branch"; branchPrefix: string; commitConvention: "conventional" | "simple" | "custom"; commitTemplate?: string; requireTests: boolean; requireLint: boolean; createPR: boolean; prTitleTemplate?: string; prDescriptionTemplate?: string; prReviewers?: string[]; prLabels?: string[]; }>; tags?: string[]; metadata?: Record<string, any>; userId: string; }): Promise<CallToolResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
args | { codebaseId: string; title?: string; description?: string; repository?: Partial<{ url: string; defaultBranch: string; provider: "github" | "gitlab" | "bitbucket" | "other"; organization?: string; repositoryName?: string; privateRepo: boolean; accessToken?: string; sshKey?: string; }>; environment?: Partial<{ nodeVersion?: string; packageManager: "npm" | "yarn" | "pnpm" | "bun"; workingDirectory?: string; setupCommands: string[]; testCommands?: string[]; buildCommands?: string[]; environmentVariables?: Record<string, string>; }>; deployment?: Partial<{ platform: "cloudflare" | "digitalocean" | "vercel" | "railway" | "aws" | "custom"; productionUrl?: string; stagingUrl?: string; previewUrlPattern?: string; deployCommand?: string; deployBranch?: string; cicdProvider?: "github-actions" | "gitlab-ci" | "cloudflare-pages" | "custom"; cicdConfigPath?: string; platformConfig?: Record<string, any>; }>; agentWorkflow?: Partial<{ branchStrategy: "feature-per-spec" | "feature-per-task" | "shared-branch"; branchPrefix: string; commitConvention: "conventional" | "simple" | "custom"; commitTemplate?: string; requireTests: boolean; requireLint: boolean; createPR: boolean; prTitleTemplate?: string; prDescriptionTemplate?: string; prReviewers?: string[]; prLabels?: string[]; }>; tags?: string[]; metadata?: Record<string, any>; userId: string; } | Yes | - Codebase update arguments |
Returns:
Promise<CallToolResult> - CallToolResult with update result
Examples:
const result = await codebaseTools.handleCodebaseUpdate({
codebaseId: 'codebase_123',
title: 'Updated Title',
repository: {
defaultBranch: 'develop'
},
tags: ['frontend', 'react'],
userId: 'user_456'
});
handleCodebaseArchive
Handle codebase archiving
Archives a codebase by setting its status to 'archived' and recording the timestamp. Archived codebases are not deleted but marked as inactive. The operation is idempotent - archiving an already archived codebase succeeds.
handleCodebaseArchive(args: { codebaseId: string; userId: string; }): Promise<CallToolResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
args | { codebaseId: string; userId: string; } | Yes | - Codebase archive arguments |
Returns:
Promise<CallToolResult> - CallToolResult with archive result
Examples:
const result = await codebaseTools.handleCodebaseArchive({
codebaseId: 'codebase_123',
userId: 'user_456'
});
handleCodebaseValidate
Handle codebase validation
Validates codebase configuration without creating it. Returns structured validation results with errors and warnings.
handleCodebaseValidate(args: any): Promise<CallToolResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
args | any | Yes | - Codebase configuration to validate |
Returns:
Promise<CallToolResult> - CallToolResult with validation results
Examples:
const result = await codebaseTools.handleCodebaseValidate({
name: 'my-app',
title: 'My Application',
description: 'Main application codebase',
workspaceId: 'workspace_123',
repository: {
url: 'https://github.com/org/repo.git',
defaultBranch: 'main',
provider: 'github',
privateRepo: true
},
environment: {
packageManager: 'yarn',
setupCommands: ['yarn install']
},
orgId: 'org_123',
userId: 'user_123'
});
CRUDTools
CRUD Tools Manager Provides generic CRUD operations for all collections
Constructor
constructor(client: IRxDBClient)
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
client | IRxDBClient | Yes |
Methods
getAvailableCollections
Get list of available collections
getAvailableCollections(): string[]
Returns:
string[] -
getCollectionMetadata
Get collection metadata
getCollectionMetadata(collectionName: string): CollectionMetadata | null
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
collectionName | string | Yes |
Returns:
CollectionMetadata \| null -
createDocument
Create a new document in a collection
createDocument(collectionName: string, data: any): Promise<any>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
collectionName | string | Yes | |
data | any | Yes |
Returns:
Promise<any> -
getDocument
Get a document by ID
getDocument(collectionName: string, documentId: string): Promise<any>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
collectionName | string | Yes | |
documentId | string | Yes |
Returns:
Promise<any> -
updateDocument
Update a document
updateDocument(collectionName: string, documentId: string, updates: any): Promise<any>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
collectionName | string | Yes | |
documentId | string | Yes | |
updates | any | Yes |
Returns:
Promise<any> -
deleteDocument
Delete a document
deleteDocument(collectionName: string, documentId: string): Promise<any>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
collectionName | string | Yes | |
documentId | string | Yes |
Returns:
Promise<any> -
queryDocuments
Query documents with RxDB selector
queryDocuments(collectionName: string, selector: any, options?: any): Promise<any>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
collectionName | string | Yes | |
selector | any | Yes | |
options | any | No |
Returns:
Promise<any> -
listDocuments
List all documents in a collection with optimized token usage
Returns only id, title, and name fields by default with a maximum of 20 items. Use offset for pagination.
listDocuments(collectionName: string, limit?: number | undefined, offset?: number): Promise<any>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
collectionName | string | Yes | - The collection to list |
limit | number | undefined | No | - Optional limit (default: 20, max: 20) |
offset | number | No | - Optional offset for pagination (default: 0) |
Returns:
Promise<any> -
getCollectionInfo
Get collection schema info (summary)
getCollectionInfo(collectionName: string): Promise<any>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
collectionName | string | Yes |
Returns:
Promise<any> -
getCollectionSchema
Get full JSON schema for a collection including all property definitions, enums, types, and formats
getCollectionSchema(collectionName: string): Promise<any>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
collectionName | string | Yes |
Returns:
Promise<any> -
listCollections
List all available collections
listCollections(): Promise<any>
Returns:
Promise<any> -
DependencyTools
Dependency Tools Handles task dependency management and validation
Constructor
constructor(client: IRxDBClient)
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
client | IRxDBClient | Yes |
Methods
setTaskDependency
Set task dependencies
Defines which tasks must be completed before this task can start. Creates bidirectional links (this task depends on X, X blocks this task).
setTaskDependency(args: { taskId: string; dependsOn: string[]; orgId: string; }): Promise<CallToolResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
args | { taskId: string; dependsOn: string[]; orgId: string; } | Yes |
Returns:
Promise<CallToolResult> -
checkTaskCanStart
Check if task can start
Validates that all dependency tasks are completed before allowing task to start.
checkTaskCanStart(args: { taskId: string; orgId: string; }): Promise<CallToolResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
args | { taskId: string; orgId: string; } | Yes |
Returns:
Promise<CallToolResult> -
getBlockedTasks
Get blocked tasks
Finds all tasks that are blocked by incomplete dependencies in a project.
getBlockedTasks(args: { projectId: string; orgId: string; }): Promise<CallToolResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
args | { projectId: string; orgId: string; } | Yes |
Returns:
Promise<CallToolResult> -
removeTaskDependency
Remove task dependency
Removes a specific dependency from a task.
removeTaskDependency(args: { taskId: string; dependencyId: string; orgId: string; }): Promise<CallToolResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
args | { taskId: string; dependencyId: string; orgId: string; } | Yes |
Returns:
Promise<CallToolResult> -
clearTaskDependencies
Clear all task dependencies
Removes all dependencies from a task.
clearTaskDependencies(args: { taskId: string; orgId: string; }): Promise<CallToolResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
args | { taskId: string; orgId: string; } | Yes |
Returns:
Promise<CallToolResult> -
DocumentTools
DocumentTools - MCP Tools for Document Management
Provides 6 MCP tools:
- document-create: Create documents with optional S3 storage
- document-get: Get document by ID with optional content fetch
- document-list: List documents with filtering
- document-update: Update document (re-uploads to S3 if needed)
- document-delete: Soft delete document
- document-search: Semantic search via RAG
Constructor
constructor(config: DocumentToolsConfig)
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
config | DocumentToolsConfig | Yes |
Methods
getAllTools
Get all document MCP tools
getAllTools(): { inputSchema: { [x: string]: unknown; type: "object"; properties?: { [x: string]: object; } | undefined; required?: string[] | undefined; }; name: string; description?: string | undefined; outputSchema?: { [x: string]: unknown; type: "object"; properties?: { [x: string]: object; } | undefined; required?: string[] | undefined; } | undefined; annotations?: { title?: string | undefined; readOnlyHint?: boolean | undefined; destructiveHint?: boolean | undefined; idempotentHint?: boolean | undefined; openWorldHint?: boolean | undefined; } | undefined; execution?: { taskSupport?: "optional" | "required" | "forbidden" | undefined; } | undefined; _meta?: { [x: string]: unknown; } | undefined; icons?: { src: string; mimeType?: string | undefined; sizes?: string[] | undefined; theme?: "light" | "dark" | undefined; }[] | undefined; title?: string | undefined; }[]
Returns:
{ inputSchema: { [x: string]: unknown; type: "object"; properties?: { [x: string]: object; } \| undefined; required?: string[] \| undefined; }; name: string; description?: string \| undefined; outputSchema?: { [x: string]: unknown; type: "object"; properties?: { [x: string]: object; } \| undefined; required?: string[] \| undefined; } \| undefined; annotations?: { title?: string \| undefined; readOnlyHint?: boolean \| undefined; destructiveHint?: boolean \| undefined; idempotentHint?: boolean \| undefined; openWorldHint?: boolean \| undefined; } \| undefined; execution?: { taskSupport?: "optional" \| "required" \| "forbidden" \| undefined; } \| undefined; _meta?: { [x: string]: unknown; } \| undefined; icons?: { src: string; mimeType?: string \| undefined; sizes?: string[] \| undefined; theme?: "light" \| "dark" \| undefined; }[] \| undefined; title?: string \| undefined; }[] -
handleToolCall
Handle MCP tool call
handleToolCall(name: string, args: Record<string, unknown>): Promise<CallToolResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | |
args | Record<string, unknown> | Yes |
Returns:
Promise<CallToolResult> -
ObservabilityTools
Observability Tools - Main Registration Class
Consolidates all observability tools and routes tool calls to appropriate handlers. Provides a unified interface for MCP server integration.
Constructor
constructor(client: ObsClient)
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
client | ObsClient | Yes | - ObsClient instance for API communication |
Methods
getAllTools
Get all observability MCP tools
Combines tools from all specialized tool classes.
getAllTools(): { inputSchema: { [x: string]: unknown; type: "object"; properties?: { [x: string]: object; } | undefined; required?: string[] | undefined; }; name: string; description?: string | undefined; outputSchema?: { [x: string]: unknown; type: "object"; properties?: { [x: string]: object; } | undefined; required?: string[] | undefined; } | undefined; annotations?: { title?: string | undefined; readOnlyHint?: boolean | undefined; destructiveHint?: boolean | undefined; idempotentHint?: boolean | undefined; openWorldHint?: boolean | undefined; } | undefined; execution?: { taskSupport?: "optional" | "required" | "forbidden" | undefined; } | undefined; _meta?: { [x: string]: unknown; } | undefined; icons?: { src: string; mimeType?: string | undefined; sizes?: string[] | undefined; theme?: "light" | "dark" | undefined; }[] | undefined; title?: string | undefined; }[]
Returns:
{ inputSchema: { [x: string]: unknown; type: "object"; properties?: { [x: string]: object; } \| undefined; required?: string[] \| undefined; }; name: string; description?: string \| undefined; outputSchema?: { [x: string]: unknown; type: "object"; properties?: { [x: string]: object; } \| undefined; required?: string[] \| undefined; } \| undefined; annotations?: { title?: string \| undefined; readOnlyHint?: boolean \| undefined; destructiveHint?: boolean \| undefined; idempotentHint?: boolean \| undefined; openWorldHint?: boolean \| undefined; } \| undefined; execution?: { taskSupport?: "optional" \| "required" \| "forbidden" \| undefined; } \| undefined; _meta?: { [x: string]: unknown; } \| undefined; icons?: { src: string; mimeType?: string \| undefined; sizes?: string[] \| undefined; theme?: "light" \| "dark" \| undefined; }[] \| undefined; title?: string \| undefined; }[] - Array of all 16 observability tools
handleToolCall
Handle tool execution
Routes tool calls to appropriate handler based on tool name prefix.
Routing logic:
- obs__errors-*, obs__error-get → ObsErrorTools
- obs__logs-*, obs__log-get → ObsLogTools
- obs__sessions-* → ObsSessionTools
- obs__projects-* → ObsProjectTools
- obs__debug-, obs__compare-, obs__suggest-, obs__create-task- → ObsAnalysisTools
handleToolCall(name: string, args: any): Promise<CallToolResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | - Tool name (must start with 'obs__') |
args | any | Yes | - Tool arguments |
Returns:
Promise<CallToolResult> - MCP-compliant tool result
ProjectInitTools
Project Init Tools Handles project initialization without CLI
Constructor
constructor(client: IRxDBClient, logger: LoggingService)
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
client | IRxDBClient | Yes | |
logger | LoggingService | Yes |
Methods
initializeProject
Initialize FlowState project
Creates workspace (if needed), codebase, and configuration files. Equivalent to running flowstate init but via MCP.
initializeProject(args: ProjectInitConfig): Promise<CallToolResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
args | ProjectInitConfig | Yes |
Returns:
Promise<CallToolResult> -
updateProjectConfig
Update project configuration
Updates .flowstate/config.json with new values.
updateProjectConfig(args: { projectPath: string; updates: Partial<Record<string, any>>; }): Promise<CallToolResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
args | { projectPath: string; updates: Partial<Record<string, any>>; } | Yes |
Returns:
Promise<CallToolResult> -
getProjectConfig
Get project configuration
Reads and returns .flowstate/config.json content.
getProjectConfig(args: { projectPath: string; }): Promise<CallToolResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
args | { projectPath: string; } | Yes |
Returns:
Promise<CallToolResult> -
RAGTools
RAG Tools - Main Registration Class
Provides MCP tools for semantic search, context building, and memory recall. Integrates with SurrealDB vector database and Ollama embeddings.
Supports two initialization modes:
- Dependency Injection (preferred): Pass RAGClient in constructor
- Lazy Initialization (legacy): Creates client on first tool call
Tools provided:
- rag-search: Natural language search across indexed documents
- rag-context: Build formatted context for LLM consumption
- rag-recall: Recall conversation memories by topic
- rag-similar: Find documents similar to a specific item
Constructor
constructor(ragClient?: RAGClient | undefined)
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
ragClient | RAGClient | undefined | No | - Optional pre-configured RAGClient instance. |
| If not provided, client will be lazily initialized on first use. |
Methods
getRAGClient
Get the underlying RAGClient instance (for sharing with other tools)
getRAGClient(): RAGClient | null
Returns:
RAGClient \| null - RAGClient if initialized, null otherwise
getAllTools
Get all RAG MCP tools
getAllTools(): { inputSchema: { [x: string]: unknown; type: "object"; properties?: { [x: string]: object; } | undefined; required?: string[] | undefined; }; name: string; description?: string | undefined; outputSchema?: { [x: string]: unknown; type: "object"; properties?: { [x: string]: object; } | undefined; required?: string[] | undefined; } | undefined; annotations?: { title?: string | undefined; readOnlyHint?: boolean | undefined; destructiveHint?: boolean | undefined; idempotentHint?: boolean | undefined; openWorldHint?: boolean | undefined; } | undefined; execution?: { taskSupport?: "optional" | "required" | "forbidden" | undefined; } | undefined; _meta?: { [x: string]: unknown; } | undefined; icons?: { src: string; mimeType?: string | undefined; sizes?: string[] | undefined; theme?: "light" | "dark" | undefined; }[] | undefined; title?: string | undefined; }[]
Returns:
{ inputSchema: { [x: string]: unknown; type: "object"; properties?: { [x: string]: object; } \| undefined; required?: string[] \| undefined; }; name: string; description?: string \| undefined; outputSchema?: { [x: string]: unknown; type: "object"; properties?: { [x: string]: object; } \| undefined; required?: string[] \| undefined; } \| undefined; annotations?: { title?: string \| undefined; readOnlyHint?: boolean \| undefined; destructiveHint?: boolean \| undefined; idempotentHint?: boolean \| undefined; openWorldHint?: boolean \| undefined; } \| undefined; execution?: { taskSupport?: "optional" \| "required" \| "forbidden" \| undefined; } \| undefined; _meta?: { [x: string]: unknown; } \| undefined; icons?: { src: string; mimeType?: string \| undefined; sizes?: string[] \| undefined; theme?: "light" \| "dark" \| undefined; }[] \| undefined; title?: string \| undefined; }[] - Array of 4 RAG tools
handleToolCall
Handle RAG tool execution
Routes tool calls to appropriate RAG client methods.
handleToolCall(name: string, args: Record<string, unknown>): Promise<CallToolResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | - Tool name (must start with 'rag-') |
args | Record<string, unknown> | Yes | - Tool arguments |
Returns:
Promise<CallToolResult> - MCP-compliant tool result
SessionTools
Session Tools Handles session context persistence and recovery
Constructor
constructor(client: IRxDBClient)
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
client | IRxDBClient | Yes |
Methods
saveSessionContext
Save session context
Persists current session state to database for recovery or handoff.
saveSessionContext(args: { sessionId?: string; codebaseId: string; workspaceId: string; projectId?: string; userId: string; orgId: string; context: Record<string, any>; expiryHours?: number; }): Promise<CallToolResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
args | { sessionId?: string; codebaseId: string; workspaceId: string; projectId?: string; userId: string; orgId: string; context: Record<string, any>; expiryHours?: number; } | Yes |
Returns:
Promise<CallToolResult> -
loadSessionContext
Load session context
Retrieves saved session state from database.
loadSessionContext(args: { sessionId: string; orgId: string; }): Promise<CallToolResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
args | { sessionId: string; orgId: string; } | Yes |
Returns:
Promise<CallToolResult> -
getActiveSession
Get active session
Finds the most recent active session for a codebase/user combination.
getActiveSession(args: { codebaseId: string; userId: string; orgId: string; }): Promise<CallToolResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
args | { codebaseId: string; userId: string; orgId: string; } | Yes |
Returns:
Promise<CallToolResult> -
deleteSession
Delete session
Removes a session from the database.
deleteSession(args: { sessionId: string; orgId: string; }): Promise<CallToolResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
args | { sessionId: string; orgId: string; } | Yes |
Returns:
Promise<CallToolResult> -
listSessions
List sessions
Lists all sessions for a codebase or user.
listSessions(args: { codebaseId?: string; userId?: string; orgId: string; includeExpired?: boolean; }): Promise<CallToolResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
args | { codebaseId?: string; userId?: string; orgId: string; includeExpired?: boolean; } | Yes |
Returns:
Promise<CallToolResult> -
extendSession
Extend session expiry
Extends the expiration time of a session.
extendSession(args: { sessionId: string; additionalHours: number; orgId: string; }): Promise<CallToolResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
args | { sessionId: string; additionalHours: number; orgId: string; } | Yes |
Returns:
Promise<CallToolResult> -
SpecManagementTools
Spec Management Tools Handles creation, status checking, and task execution for specifications
Constructor
constructor(client: IRxDBClient, workspaceManager?: WorkspaceManager | undefined, codebaseManager?: CodebaseManager | undefined)
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
client | IRxDBClient | Yes | |
workspaceManager | WorkspaceManager | undefined | No | |
codebaseManager | CodebaseManager | undefined | No |
Methods
createSpec
Create a new specification with milestone structure
createSpec(args: SpecCreateArgs): Promise<SpecCreateResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
args | SpecCreateArgs | Yes |
Returns:
Promise<SpecCreateResult> -
getSpecStatus
Get status of a specification
getSpecStatus(args: SpecStatusArgs): Promise<SpecStatusResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
args | SpecStatusArgs | Yes |
Returns:
Promise<SpecStatusResult> -
executeTask
Execute or queue a task for execution
executeTask(args: SpecExecuteTaskArgs): Promise<TaskExecutionResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
args | SpecExecuteTaskArgs | Yes |
Returns:
Promise<TaskExecutionResult> -
updatePhaseDocument
Update phase document content in milestone metadata
Stores markdown content for requirements, design, tasks, or implementation phases in the corresponding Milestone.metadata.workflowData field.
updatePhaseDocument(projectId: string, phaseType: "tasks" | "requirements" | "design" | "implementation", content: string): Promise<void>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
projectId | string | Yes | - ID of the spec project |
phaseType | "tasks" | "requirements" | "design" | "implementation" | Yes | - Phase type (requirements, design, tasks, implementation) |
content | string | Yes | - Markdown content to store |
Returns:
Promise<void> -
Examples:
await tools.updatePhaseDocument(
'proj_abc123',
'requirements',
'# Requirements\n\n## User Stories\n...'
);
getPhaseDocument
Get phase document content from milestone metadata
Retrieves markdown content for requirements, design, tasks, or implementation phases from the corresponding Milestone.metadata.workflowData field.
getPhaseDocument(projectId: string, phaseType: "tasks" | "requirements" | "design" | "implementation"): Promise<{ content: string; approved: boolean; lastUpdated?: string; approvedAt?: string; approvedBy?: string; } | null>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
projectId | string | Yes | - ID of the spec project |
phaseType | "tasks" | "requirements" | "design" | "implementation" | Yes | - Phase type (requirements, design, tasks, implementation) |
Returns:
Promise<{ content: string; approved: boolean; lastUpdated?: string; approvedAt?: string; approvedBy?: string; } \| null> - Phase document content and metadata, or null if not found
Examples:
const doc = await tools.getPhaseDocument('proj_abc123', 'requirements');
if (doc) {
console.log(doc.content);
console.log(doc.approved);
}
approvePhaseDocument
Approve phase document by updating approval status in milestone metadata
Updates the approval status and timestamp for a phase document in the Milestone.metadata.workflowData field.
approvePhaseDocument(projectId: string, phaseType: "tasks" | "requirements" | "design" | "implementation", approvedBy: string): Promise<void>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
projectId | string | Yes | - ID of the spec project |
phaseType | "tasks" | "requirements" | "design" | "implementation" | Yes | - Phase type (requirements, design, tasks, implementation) |
approvedBy | string | Yes | - User ID who is approving the document |
Returns:
Promise<void> -
Examples:
await tools.approvePhaseDocument('proj_abc123', 'requirements', 'user-456');
createTasksFromMarkdown
Create tasks from markdown task list
Parses a markdown task list and creates individual Task documents in the Tasks collection. Each task is linked to the spec project and the Tasks milestone.
createTasksFromMarkdown(projectId: string, tasksMarkdown: string, userId: string, orgId: string): Promise<{ success: boolean; tasksCreated: number; taskIds: string[]; message: string; }>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
projectId | string | Yes | - ID of the spec project |
tasksMarkdown | string | Yes | - Markdown task list (supports checkboxes and hierarchy) |
userId | string | Yes | - User ID creating the tasks |
orgId | string | Yes | - Organization ID |
Returns:
Promise<{ success: boolean; tasksCreated: number; taskIds: string[]; message: string; }> - Result with created task IDs
Examples:
await tools.createTasksFromMarkdown(
'proj_abc123',
'- [ ] 1.1 Create component\n - [ ] 1.1.1 Add props\n- [ ] 1.2 Add tests',
'user-456',
'org-789'
);
getSpecTasks
Get tasks for a specification
Retrieves all tasks for a spec project, including metadata like taskNumber, requirements, leverage, prompt.
getSpecTasks(projectId: string): Promise<{ success: boolean; tasks: any[]; message: string; }>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
projectId | string | Yes | - ID of the spec project |
Returns:
Promise<{ success: boolean; tasks: any[]; message: string; }> - List of tasks with metadata
Examples:
const result = await tools.getSpecTasks('proj_abc123');
console.log(result.tasks); // Array of task objects
startTask
Start a task - Sets status to 'In Progress' and sets startedAt timestamp
IMPORTANT: Enforces sequential task completion. Validates that all previous tasks (lower task numbers) are completed before allowing this task to start.
startTask(taskId: string): Promise<{ success: boolean; message: string; }>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
taskId | string | Yes | - ID of the task to start |
Returns:
Promise<{ success: boolean; message: string; }> - Success result
Examples:
await tools.startTask('task_abc123');
stopTask
Stop a task - Sets status and handles completion
Status Options:
- 'To Do': Task not yet started (reverts to initial state)
- 'In Progress': Task actively being worked on
- 'Complete': Task finished successfully (sets completedAt)
- 'On Hold': Task paused (requires reason in metadata)
- 'Blocked': Task cannot proceed (requires reason in metadata)
stopTask(taskId: string, status: "To Do" | "In Progress" | "Complete" | "On Hold" | "Blocked", reason?: string | undefined): Promise<{ success: boolean; message: string; }>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
taskId | string | Yes | - ID of the task to stop |
status | "To Do" | "In Progress" | "Complete" | "On Hold" | "Blocked" | Yes | - New status for the task |
reason | string | undefined | No | - Required reason if status is 'On Hold' or 'Blocked' |
Returns:
Promise<{ success: boolean; message: string; }> - Success result
Examples:
// Complete a task
await tools.stopTask('task_abc123', 'Complete');
// Block a task with reason
await tools.stopTask('task_abc123', 'Blocked', 'Waiting for API access');
updateTask
Update a task's basic fields (description, etc.)
For task lifecycle management, use startTask() and stopTask() instead.
updateTask(taskId: string, updates: { description?: string; }): Promise<{ success: boolean; message: string; }>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
taskId | string | Yes | - ID of the task to update |
updates | { description?: string; } | Yes | - Fields to update |
Returns:
Promise<{ success: boolean; message: string; }> - Success result
Examples:
await tools.updateTask('task_abc123', {
description: 'Updated task description'
});
listSpecs
List all available specs
Returns all projects with categoryId='spec-workflow' with basic information including name, description, phase, and completion status.
listSpecs(orgId?: string | undefined): Promise<{ success: boolean; specs: Array<{ id: string; name: string; description: string; phase: string; completed: boolean; createdAt: string; updatedAt: string; }>; message: string; }>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
orgId | string | undefined | No | - Optional organization ID to filter specs |
Returns:
Promise<{ success: boolean; specs: Array<{ id: string; name: string; description: string; phase: string; completed: boolean; createdAt: string; updatedAt: string; }>; message: string; }> - List of spec projects with summary information
Examples:
const result = await tools.listSpecs('org-123');
console.log(result.specs); // Array of spec summaries
WorkflowTools
Workflow Tools Handles workflow guide retrieval, approval management, and steering guidance
Constructor
constructor(client: IRxDBClient, approvalManager: ApprovalManager, templateManager: TemplateManager, steeringManager: SteeringManager)
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
client | IRxDBClient | Yes | |
approvalManager | ApprovalManager | Yes | |
templateManager | TemplateManager | Yes | |
steeringManager | SteeringManager | Yes |
Methods
getWorkflowGuide
Get comprehensive workflow guide
Returns the complete spec development workflow guide including:
- Workflow overview and diagram
- All four phases (Requirements, Design, Tasks, Implementation)
- Approval process instructions
- File structure documentation
- Workflow rules and best practices
- Dashboard integration info
This is a static guide that doesn't require database access and can be called multiple times without performance impact.
getWorkflowGuide(): Promise<WorkflowGuideResult>
Returns:
Promise<WorkflowGuideResult> - WorkflowGuideResult with guide content and dashboard info
Examples:
const result = await workflowTools.getWorkflowGuide();
console.log(result.content[0].text); // Full workflow guide markdown
console.log(result.dashboardUrl); // Dashboard URL if available
handleApprovals
Handle approval workflow operations
Provides MCP tool interface for approval management supporting three actions:
- request: Create a new approval request
- status: Check approval status
- delete: Remove an approval after it's been handled
handleApprovals(args: { action: "request" | "status" | "delete"; projectId?: string; title?: string; type?: "document" | "action"; category?: "spec" | "steering"; categoryName?: string; documentType?: string; filePath?: string; milestoneId?: string; orgId?: string; userId?: string; approvalId?: string; }): Promise<CallToolResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
args | { action: "request" | "status" | "delete"; projectId?: string; title?: string; type?: "document" | "action"; category?: "spec" | "steering"; categoryName?: string; documentType?: string; filePath?: string; milestoneId?: string; orgId?: string; userId?: string; approvalId?: string; } | Yes | - Approval operation arguments |
Returns:
Promise<CallToolResult> - CallToolResult with operation result
Examples:
// Request approval
await workflowTools.handleApprovals({
action: 'request',
projectId: 'proj_123',
title: 'Requirements Review',
type: 'document',
category: 'spec',
categoryName: 'auth-feature',
documentType: 'requirements',
filePath: '.spec-workflow/specs/auth-feature/requirements.md',
orgId: 'org_123',
userId: 'user_123'
});
// Check status
await workflowTools.handleApprovals({
action: 'status',
approvalId: 'approval_123'
});
// Delete approval
await workflowTools.handleApprovals({
action: 'delete',
approvalId: 'approval_123'
});
getSteeringGuide
Get steering document creation guide
Returns comprehensive guidance for creating project steering documents including:
- Steering workflow overview and diagram
- All three phases (Product, Tech, Structure)
- Approval process for each steering document
- File structure and template guidance
- Workflow rules for steering document creation
Steering documents are optional and should only be created when explicitly requested. They establish vision, architecture, and conventions for established codebases.
getSteeringGuide(): Promise<CallToolResult>
Returns:
Promise<CallToolResult> - CallToolResult with steering guide content
Examples:
const result = await workflowTools.getSteeringGuide();
console.log(result.content[0].text); // Full steering guide markdown
WorkspaceTools
Workspace Tools Handles workspace management operations through MCP interface
Constructor
constructor(client: IRxDBClient, workspaceManager: WorkspaceManager, logger: LoggingService)
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
client | IRxDBClient | Yes | |
workspaceManager | WorkspaceManager | Yes | |
logger | LoggingService | Yes |
Methods
handleWorkspaceCreate
Handle workspace creation
Creates a new workspace with the provided configuration. The workspace name will be sanitized to kebab-case automatically.
handleWorkspaceCreate(args: { name: string; title: string; description: string; orgId: string; userId: string; tags?: string[]; metadata?: Record<string, any>; }): Promise<CallToolResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
args | { name: string; title: string; description: string; orgId: string; userId: string; tags?: string[]; metadata?: Record<string, any>; } | Yes | - Workspace creation arguments |
Returns:
Promise<CallToolResult> - CallToolResult with workspace creation result
Examples:
const result = await workspaceTools.handleWorkspaceCreate({
name: 'My Workspace',
title: 'My Awesome Workspace',
description: 'A workspace for awesome projects',
orgId: 'org_123',
userId: 'user_123',
tags: ['frontend', 'backend'],
metadata: { teamMembers: ['user1', 'user2'] }
});
handleWorkspaceList
Handle workspace listing
Lists workspaces with optional filters for status, organization, or name. Returns workspace list formatted as JSON.
handleWorkspaceList(args: { orgId?: string; status?: "active" | "archived" | "paused"; name?: string; }): Promise<CallToolResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
args | { orgId?: string; status?: "active" | "archived" | "paused"; name?: string; } | Yes | - Workspace listing filters |
Returns:
Promise<CallToolResult> - CallToolResult with workspace list
Examples:
// List all active workspaces in an organization
const result = await workspaceTools.handleWorkspaceList({
orgId: 'org_123',
status: 'active'
});
// List workspaces by name
const result = await workspaceTools.handleWorkspaceList({
name: 'frontend-team'
});
handleWorkspaceGet
Handle workspace retrieval
Retrieves a single workspace by ID with full details.
handleWorkspaceGet(args: { workspaceId: string; }): Promise<CallToolResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
args | { workspaceId: string; } | Yes | - Workspace retrieval arguments |
Returns:
Promise<CallToolResult> - CallToolResult with workspace details
Examples:
const result = await workspaceTools.handleWorkspaceGet({
workspaceId: 'workspace_123'
});
handleWorkspaceUpdate
Handle workspace update
Updates one or more fields of an existing workspace. Only provided fields will be updated.
handleWorkspaceUpdate(args: { workspaceId: string; title?: string; description?: string; tags?: string[]; metadata?: Record<string, any>; userId: string; }): Promise<CallToolResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
args | { workspaceId: string; title?: string; description?: string; tags?: string[]; metadata?: Record<string, any>; userId: string; } | Yes | - Workspace update arguments |
Returns:
Promise<CallToolResult> - CallToolResult with update result
Examples:
const result = await workspaceTools.handleWorkspaceUpdate({
workspaceId: 'workspace_123',
title: 'Updated Title',
tags: ['frontend', 'react'],
userId: 'user_456'
});
handleWorkspaceArchive
Handle workspace archiving
Archives a workspace by setting its status to 'archived' and recording the timestamp. Archived workspaces are not deleted but marked as inactive. The operation is idempotent - archiving an already archived workspace succeeds.
handleWorkspaceArchive(args: { workspaceId: string; userId: string; }): Promise<CallToolResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
args | { workspaceId: string; userId: string; } | Yes | - Workspace archive arguments |
Returns:
Promise<CallToolResult> - CallToolResult with archive result
Examples:
const result = await workspaceTools.handleWorkspaceArchive({
workspaceId: 'workspace_123',
userId: 'user_456'
});
TaskParser
TaskParser - Static utility class for parsing markdown task lists
This class provides a suite of static methods for parsing markdown task lists following the tasks.md format used in spec-workflow. All methods are stateless and can be used independently or combined through parseTasksMarkdown().
Regex Pattern Components (used across multiple methods):
^\s*- Start of line with optional leading whitespace (spaces, tabs)(?:[-*]|\d+\.)- List marker: dash, asterisk, or numbered list (1., 2., etc.)\[\s*[xX\-\s]\s*\]- Checkbox with flexible whitespace: [ ], [x], [-], [ x ], etc.\d+(?:\.\d+)*- Hierarchical task number: 1, 1.1, 1.2.3, etc.
Methods
extractCheckboxState
Extract checkbox state from a markdown task line
Parses markdown task lines to extract the checkbox state (pending, in-progress, or completed). Handles various markdown list formats (dash, asterisk, numbered) and whitespace variations.
Behavior:
- Returns
'[ ]'for pending tasks (empty checkbox or spaces only) - Returns
'[-]'for in-progress tasks (hyphen in checkbox) - Returns
'[x]'for completed tasks (x in checkbox, case-insensitive) - Returns
nullfor lines without valid checkbox format - Extracts first checkbox when multiple are present
- Normalizes whitespace inside brackets (e.g.,
[ x ]→'[x]')
Supported formats:
- Dash lists:
- [ ] Task - Asterisk lists:
* [-] Task - Numbered lists:
1. [x] Task - Indented tasks:
- [ ] Task - Mixed whitespace: tabs, spaces, no spaces between marker and checkbox
extractCheckboxState(line: string): MarkdownStatus | null
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
line | string | Yes | - Markdown task line to parse |
Returns:
MarkdownStatus \| null - Checkbox state ('[ ]', '[-]', '[x]') or null if no valid checkbox
Examples:
TaskParser.extractCheckboxState('- [ ] My task'); // Returns: '[ ]'
TaskParser.extractCheckboxState(' - [x] Done'); // Returns: '[x]'
TaskParser.extractCheckboxState('* [-] Working'); // Returns: '[-]'
TaskParser.extractCheckboxState('No checkbox'); // Returns: null
TaskParser.extractCheckboxState('- [X] DONE'); // Returns: '[x]' (normalized)
TaskParser.extractCheckboxState('- [ x ] Space'); // Returns: '[x]' (whitespace normalized)
extractTaskHierarchy
Extract hierarchical task number and parent information from a markdown task line
Parses markdown task lines to extract hierarchical task numbers (1, 1.1, 1.1.1, etc.), calculate the parent number, and determine the hierarchy level.
Behavior:
- Extracts dot-separated task numbers (1, 1.1, 1.1.1, 1.2.3.4, etc.)
- Calculates parent number by removing last segment (1.2.3 → parent: 1.2)
- Determines level by counting segments (1 = level 1, 1.2 = level 2, 1.2.3 = level 3)
- Handles trailing dots (strips them before processing: "1.2." → "1.2")
- Returns default values for tasks without valid hierarchical numbers
- Extracts first valid hierarchical number (ignores numbers in description)
- Validates task number format (no leading/trailing/double dots)
Supported formats:
- Top-level:
- [ ] 1 Task→ {taskNumber: '1', parentNumber: null, level: 1} - Second-level:
- [ ] 1.2 Task→ {taskNumber: '1.2', parentNumber: '1', level: 2} - Third-level:
- [ ] 1.2.3 Task→ {taskNumber: '1.2.3', parentNumber: '1.2', level: 3} - Deep hierarchy:
- [ ] 1.2.3.4.5 Task→ {taskNumber: '1.2.3.4.5', parentNumber: '1.2.3.4', level: 5} - No hierarchy:
- [ ] Task→ {taskNumber: null, parentNumber: null, level: 0}
extractTaskHierarchy(line: string): TaskHierarchy
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
line | string | Yes | - Markdown task line to parse |
Returns:
TaskHierarchy - Task hierarchy information with taskNumber, parentNumber, and level
Examples:
TaskParser.extractTaskHierarchy('- [ ] 1 Top level');
// Returns: {taskNumber: '1', parentNumber: null, level: 1}
TaskParser.extractTaskHierarchy('- [ ] 1.2.3 Third level');
// Returns: {taskNumber: '1.2.3', parentNumber: '1.2', level: 3}
TaskParser.extractTaskHierarchy('- [ ] Task without number');
// Returns: {taskNumber: null, parentNumber: null, level: 0}
TaskParser.extractTaskHierarchy('- [ ] 1.2. Task with trailing dot');
// Returns: {taskNumber: '1.2', parentNumber: '1', level: 2} (dot stripped)
extractTaskMetadata
Extract task metadata from a markdown task block
Parses task blocks to extract metadata fields (_Requirements, _Leverage, _Prompt) from sub-bullet items. All fields are optional and return null if not present.
Behavior:
- Extracts _Requirements: field content
- Extracts _Leverage: field content
- Extracts _Prompt: field content (often multi-line in source, single line here)
- All fields are optional (return null if missing)
- Trims whitespace from extracted content
- Extracts first occurrence if field appears multiple times
- Handles various indentation levels
- Supports special characters, backticks, markdown formatting in content
- Case-sensitive field names (must start with underscore and capital letter)
Metadata Format:
- Main task line followed by indented sub-bullets
- Metadata fields start with underscore:
- _FieldName: content - Fields can appear in any order
- Non-metadata bullets are ignored
Supported formats:
- [ ] Task description
- File: test.ts
- _Requirements: Requirement 4 (Task Parsing)
- _Leverage: Existing patterns
- _Prompt: Role: Dev | Task: Code | Success: Done
extractTaskMetadata(taskBlock: string): TaskMetadata
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
taskBlock | string | Yes | - Complete task block including sub-bullets (multi-line string) |
Returns:
TaskMetadata - TaskMetadata object with requirements, leverage, and prompt fields
Examples:
const taskBlock = `- [ ] 1.1 Task
- _Requirements: Requirement 4 (Task Parsing and Synchronization)
- _Leverage: Jest patterns`;
TaskParser.extractTaskMetadata(taskBlock);
// Returns: {
// requirements: 'Requirement 4 (Task Parsing and Synchronization)',
// leverage: 'Jest patterns',
// prompt: null
// }
parseTasksMarkdown
Parse complete tasks.md markdown into structured task data
Combines all TaskParser extraction methods to parse a complete tasks.md file into an array of structured ParsedTask objects. Each task includes checkbox state, hierarchical numbering, description, and metadata fields.
Behavior:
- Parses markdown into individual task blocks (main line + sub-bullets)
- Extracts checkbox state using extractCheckboxState
- Extracts hierarchy info using extractTaskHierarchy
- Extracts metadata using extractTaskMetadata
- Extracts task description from main line (strips prefixes)
- Handles malformed tasks gracefully (skips tasks without valid checkbox)
- Returns empty array for empty/invalid input
- Preserves raw line for reference and debugging
- Groups sub-bullets with their parent task for metadata extraction
Task Block Format:
- [x] 1.2.3 Task description
- File: path/to/file.ts
- Additional context
- _Requirements: Requirement text
- _Leverage: Leverage text
- _Prompt: Prompt text
Parsing Strategy:
- Split markdown into lines
- Identify task lines (start with list marker + checkbox)
- Group each task line with its indented sub-bullets
- Apply all extraction methods to each task block
- Build ParsedTask objects with combined results
- Skip malformed tasks (missing valid checkbox)
Performance:
- Single pass through input (O(n) where n = number of lines)
- Regex patterns compiled once (static constants)
- Efficient string operations (no unnecessary allocations)
parseTasksMarkdown(markdown: string): ParsedTask[]
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
markdown | string | Yes | - Complete tasks.md file content |
Returns:
ParsedTask[] - Array of parsed task objects
Examples:
const markdown = `
# My Tasks
- [x] 1 First task
- _Requirements: Requirement 1
- _Leverage: Use existing code
- [-] 2 Second task
- File: src/example.ts
- [ ] 3 Third task
`;
const tasks = TaskParser.parseTasksMarkdown(markdown);
// Returns: [
// {
// rawLine: '- [x] 1 First task',
// status: '[x]',
// taskNumber: '1',
// parentNumber: null,
// level: 1,
// description: 'First task',
// metadata: {
// requirements: 'Requirement 1',
// leverage: 'Use existing code',
// prompt: null
// }
// },
// {
// rawLine: '- [-] 2 Second task',
// status: '[-]',
// taskNumber: '2',
// parentNumber: null,
// level: 1,
// description: 'Second task',
// metadata: {
// requirements: null,
// leverage: null,
// prompt: null
// }
// },
// {
// rawLine: '- [ ] 3 Third task',
// status: '[ ]',
// taskNumber: '3',
// parentNumber: null,
// level: 1,
// description: 'Third task',
// metadata: {
// requirements: null,
// leverage: null,
// prompt: null
// }
// }
// ]
Examples:
// Complete parsing
const tasks = TaskParser.parseTasksMarkdown(markdown);
// Individual extraction
const status = TaskParser.extractCheckboxState(line);
const hierarchy = TaskParser.extractTaskHierarchy(line);
const metadata = TaskParser.extractTaskMetadata(block);
ObsAnalysisTools
Observability Analysis Tools
Provides sophisticated debugging and analysis capabilities combining errors, sessions, and breadcrumbs for comprehensive issue investigation.
Constructor
constructor(client: ObsClient)
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
client | ObsClient | Yes |
Methods
getTools
Get all analysis-related MCP tools
Returns tool definitions with schemas for the MCP server.
getTools(): { inputSchema: { [x: string]: unknown; type: "object"; properties?: { [x: string]: object; } | undefined; required?: string[] | undefined; }; name: string; description?: string | undefined; outputSchema?: { [x: string]: unknown; type: "object"; properties?: { [x: string]: object; } | undefined; required?: string[] | undefined; } | undefined; annotations?: { title?: string | undefined; readOnlyHint?: boolean | undefined; destructiveHint?: boolean | undefined; idempotentHint?: boolean | undefined; openWorldHint?: boolean | undefined; } | undefined; execution?: { taskSupport?: "optional" | "required" | "forbidden" | undefined; } | undefined; _meta?: { [x: string]: unknown; } | undefined; icons?: { src: string; mimeType?: string | undefined; sizes?: string[] | undefined; theme?: "light" | "dark" | undefined; }[] | undefined; title?: string | undefined; }[]
Returns:
{ inputSchema: { [x: string]: unknown; type: "object"; properties?: { [x: string]: object; } \| undefined; required?: string[] \| undefined; }; name: string; description?: string \| undefined; outputSchema?: { [x: string]: unknown; type: "object"; properties?: { [x: string]: object; } \| undefined; required?: string[] \| undefined; } \| undefined; annotations?: { title?: string \| undefined; readOnlyHint?: boolean \| undefined; destructiveHint?: boolean \| undefined; idempotentHint?: boolean \| undefined; openWorldHint?: boolean \| undefined; } \| undefined; execution?: { taskSupport?: "optional" \| "required" \| "forbidden" \| undefined; } \| undefined; _meta?: { [x: string]: unknown; } \| undefined; icons?: { src: string; mimeType?: string \| undefined; sizes?: string[] \| undefined; theme?: "light" \| "dark" \| undefined; }[] \| undefined; title?: string \| undefined; }[] -
handleTool
Handle tool execution
Routes tool calls to appropriate handler methods.
handleTool(name: string, args: any): Promise<CallToolResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | - Tool name |
args | any | Yes | - Tool arguments |
Returns:
Promise<CallToolResult> - MCP-compliant tool result
ObsErrorTools
Observability Error Tools
Handles error event querying and analysis through MCP tools. Provides formatted output optimized for AI agent consumption.
Constructor
constructor(client: ObsClient)
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
client | ObsClient | Yes |
Methods
getTools
Get all error-related MCP tools
Returns tool definitions with schemas for the MCP server.
getTools(): { inputSchema: { [x: string]: unknown; type: "object"; properties?: { [x: string]: object; } | undefined; required?: string[] | undefined; }; name: string; description?: string | undefined; outputSchema?: { [x: string]: unknown; type: "object"; properties?: { [x: string]: object; } | undefined; required?: string[] | undefined; } | undefined; annotations?: { title?: string | undefined; readOnlyHint?: boolean | undefined; destructiveHint?: boolean | undefined; idempotentHint?: boolean | undefined; openWorldHint?: boolean | undefined; } | undefined; execution?: { taskSupport?: "optional" | "required" | "forbidden" | undefined; } | undefined; _meta?: { [x: string]: unknown; } | undefined; icons?: { src: string; mimeType?: string | undefined; sizes?: string[] | undefined; theme?: "light" | "dark" | undefined; }[] | undefined; title?: string | undefined; }[]
Returns:
{ inputSchema: { [x: string]: unknown; type: "object"; properties?: { [x: string]: object; } \| undefined; required?: string[] \| undefined; }; name: string; description?: string \| undefined; outputSchema?: { [x: string]: unknown; type: "object"; properties?: { [x: string]: object; } \| undefined; required?: string[] \| undefined; } \| undefined; annotations?: { title?: string \| undefined; readOnlyHint?: boolean \| undefined; destructiveHint?: boolean \| undefined; idempotentHint?: boolean \| undefined; openWorldHint?: boolean \| undefined; } \| undefined; execution?: { taskSupport?: "optional" \| "required" \| "forbidden" \| undefined; } \| undefined; _meta?: { [x: string]: unknown; } \| undefined; icons?: { src: string; mimeType?: string \| undefined; sizes?: string[] \| undefined; theme?: "light" \| "dark" \| undefined; }[] \| undefined; title?: string \| undefined; }[] -
handleTool
Handle tool execution
Routes tool calls to appropriate handler methods.
handleTool(name: string, args: any): Promise<CallToolResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | - Tool name (obs__errors-list, obs__error-get, obs__errors-stats) |
args | any | Yes | - Tool arguments |
Returns:
Promise<CallToolResult> - MCP-compliant tool result
ObsLogTools
Observability Log Tools
Handles log event querying and searching through MCP tools. Provides formatted output optimized for AI agent consumption.
Constructor
constructor(client: ObsClient)
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
client | ObsClient | Yes |
Methods
getTools
Get all log-related MCP tools
Returns tool definitions with schemas for the MCP server.
getTools(): { inputSchema: { [x: string]: unknown; type: "object"; properties?: { [x: string]: object; } | undefined; required?: string[] | undefined; }; name: string; description?: string | undefined; outputSchema?: { [x: string]: unknown; type: "object"; properties?: { [x: string]: object; } | undefined; required?: string[] | undefined; } | undefined; annotations?: { title?: string | undefined; readOnlyHint?: boolean | undefined; destructiveHint?: boolean | undefined; idempotentHint?: boolean | undefined; openWorldHint?: boolean | undefined; } | undefined; execution?: { taskSupport?: "optional" | "required" | "forbidden" | undefined; } | undefined; _meta?: { [x: string]: unknown; } | undefined; icons?: { src: string; mimeType?: string | undefined; sizes?: string[] | undefined; theme?: "light" | "dark" | undefined; }[] | undefined; title?: string | undefined; }[]
Returns:
{ inputSchema: { [x: string]: unknown; type: "object"; properties?: { [x: string]: object; } \| undefined; required?: string[] \| undefined; }; name: string; description?: string \| undefined; outputSchema?: { [x: string]: unknown; type: "object"; properties?: { [x: string]: object; } \| undefined; required?: string[] \| undefined; } \| undefined; annotations?: { title?: string \| undefined; readOnlyHint?: boolean \| undefined; destructiveHint?: boolean \| undefined; idempotentHint?: boolean \| undefined; openWorldHint?: boolean \| undefined; } \| undefined; execution?: { taskSupport?: "optional" \| "required" \| "forbidden" \| undefined; } \| undefined; _meta?: { [x: string]: unknown; } \| undefined; icons?: { src: string; mimeType?: string \| undefined; sizes?: string[] \| undefined; theme?: "light" \| "dark" \| undefined; }[] \| undefined; title?: string \| undefined; }[] -
handleTool
Handle tool execution
Routes tool calls to appropriate handler methods.
handleTool(name: string, args: any): Promise<CallToolResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | - Tool name (obs__logs-list, obs__log-get, obs__logs-search) |
args | any | Yes | - Tool arguments |
Returns:
Promise<CallToolResult> - MCP-compliant tool result
ObsProjectTools
Observability Project Tools
Handles project management operations through MCP tools. Provides formatted output optimized for AI agent consumption.
Constructor
constructor(client: ObsClient)
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
client | ObsClient | Yes |
Methods
getTools
Get all project-related MCP tools
Returns tool definitions with schemas for the MCP server.
getTools(): { inputSchema: { [x: string]: unknown; type: "object"; properties?: { [x: string]: object; } | undefined; required?: string[] | undefined; }; name: string; description?: string | undefined; outputSchema?: { [x: string]: unknown; type: "object"; properties?: { [x: string]: object; } | undefined; required?: string[] | undefined; } | undefined; annotations?: { title?: string | undefined; readOnlyHint?: boolean | undefined; destructiveHint?: boolean | undefined; idempotentHint?: boolean | undefined; openWorldHint?: boolean | undefined; } | undefined; execution?: { taskSupport?: "optional" | "required" | "forbidden" | undefined; } | undefined; _meta?: { [x: string]: unknown; } | undefined; icons?: { src: string; mimeType?: string | undefined; sizes?: string[] | undefined; theme?: "light" | "dark" | undefined; }[] | undefined; title?: string | undefined; }[]
Returns:
{ inputSchema: { [x: string]: unknown; type: "object"; properties?: { [x: string]: object; } \| undefined; required?: string[] \| undefined; }; name: string; description?: string \| undefined; outputSchema?: { [x: string]: unknown; type: "object"; properties?: { [x: string]: object; } \| undefined; required?: string[] \| undefined; } \| undefined; annotations?: { title?: string \| undefined; readOnlyHint?: boolean \| undefined; destructiveHint?: boolean \| undefined; idempotentHint?: boolean \| undefined; openWorldHint?: boolean \| undefined; } \| undefined; execution?: { taskSupport?: "optional" \| "required" \| "forbidden" \| undefined; } \| undefined; _meta?: { [x: string]: unknown; } \| undefined; icons?: { src: string; mimeType?: string \| undefined; sizes?: string[] \| undefined; theme?: "light" \| "dark" \| undefined; }[] \| undefined; title?: string \| undefined; }[] -
handleTool
Handle tool execution
Routes tool calls to appropriate handler methods.
handleTool(name: string, args: any): Promise<CallToolResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | - Tool name (obs__projects-create, obs__projects-list, obs__projects-stats) |
args | any | Yes | - Tool arguments |
Returns:
Promise<CallToolResult> - MCP-compliant tool result
ObsSessionTools
Observability Session Tools
Handles session querying and breadcrumb analysis through MCP tools. Provides formatted output optimized for AI agent consumption.
Constructor
constructor(client: ObsClient)
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
client | ObsClient | Yes |
Methods
getTools
Get all session-related MCP tools
Returns tool definitions with schemas for the MCP server.
getTools(): { inputSchema: { [x: string]: unknown; type: "object"; properties?: { [x: string]: object; } | undefined; required?: string[] | undefined; }; name: string; description?: string | undefined; outputSchema?: { [x: string]: unknown; type: "object"; properties?: { [x: string]: object; } | undefined; required?: string[] | undefined; } | undefined; annotations?: { title?: string | undefined; readOnlyHint?: boolean | undefined; destructiveHint?: boolean | undefined; idempotentHint?: boolean | undefined; openWorldHint?: boolean | undefined; } | undefined; execution?: { taskSupport?: "optional" | "required" | "forbidden" | undefined; } | undefined; _meta?: { [x: string]: unknown; } | undefined; icons?: { src: string; mimeType?: string | undefined; sizes?: string[] | undefined; theme?: "light" | "dark" | undefined; }[] | undefined; title?: string | undefined; }[]
Returns:
{ inputSchema: { [x: string]: unknown; type: "object"; properties?: { [x: string]: object; } \| undefined; required?: string[] \| undefined; }; name: string; description?: string \| undefined; outputSchema?: { [x: string]: unknown; type: "object"; properties?: { [x: string]: object; } \| undefined; required?: string[] \| undefined; } \| undefined; annotations?: { title?: string \| undefined; readOnlyHint?: boolean \| undefined; destructiveHint?: boolean \| undefined; idempotentHint?: boolean \| undefined; openWorldHint?: boolean \| undefined; } \| undefined; execution?: { taskSupport?: "optional" \| "required" \| "forbidden" \| undefined; } \| undefined; _meta?: { [x: string]: unknown; } \| undefined; icons?: { src: string; mimeType?: string \| undefined; sizes?: string[] \| undefined; theme?: "light" \| "dark" \| undefined; }[] \| undefined; title?: string \| undefined; }[] -
handleTool
Handle tool execution
Routes tool calls to appropriate handler methods.
handleTool(name: string, args: any): Promise<CallToolResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | - Tool name (obs__sessions-list, obs__sessions-get, obs__sessions-breadcrumbs) |
args | any | Yes | - Tool arguments |
Returns:
Promise<CallToolResult> - MCP-compliant tool result