project-mcp.ts 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /**
  2. * Project MCP - Manages project info (title + description) during PBL generation.
  3. *
  4. * Migrated from PBL-Nano. No HTML rendering, no list_tools().
  5. * Operates directly on a shared PBLProjectConfig.
  6. */
  7. import type { PBLProjectConfig, PBLToolResult } from '../types';
  8. export class ProjectMCP {
  9. private config: PBLProjectConfig;
  10. constructor(config: PBLProjectConfig) {
  11. this.config = config;
  12. }
  13. getProjectInfo(): PBLToolResult {
  14. return {
  15. success: true,
  16. title: this.config.projectInfo.title,
  17. description: this.config.projectInfo.description,
  18. };
  19. }
  20. updateTitle(title: string): PBLToolResult {
  21. if (!title?.trim()) {
  22. return { success: false, error: 'Title cannot be empty.' };
  23. }
  24. this.config.projectInfo.title = title;
  25. return { success: true, message: 'Title updated successfully.' };
  26. }
  27. updateDescription(description: string): PBLToolResult {
  28. if (description === null || description === undefined) {
  29. return { success: false, error: 'Description cannot be null.' };
  30. }
  31. this.config.projectInfo.description = description;
  32. return { success: true, message: 'Description updated successfully.' };
  33. }
  34. }