@goonnguyen/human-mcp 1.3.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/README.md +261 -19
  2. package/bin/human-mcp.js +2 -0
  3. package/dist/index.js +65180 -1698
  4. package/package.json +19 -2
  5. package/.claude/agents/code-reviewer.md +0 -140
  6. package/.claude/agents/database-admin.md +0 -86
  7. package/.claude/agents/debugger.md +0 -119
  8. package/.claude/agents/docs-manager.md +0 -113
  9. package/.claude/agents/git-manager.md +0 -59
  10. package/.claude/agents/planner-researcher.md +0 -97
  11. package/.claude/agents/project-manager.md +0 -113
  12. package/.claude/agents/tester.md +0 -95
  13. package/.claude/commands/cook.md +0 -7
  14. package/.claude/commands/debug.md +0 -10
  15. package/.claude/commands/docs/init.md +0 -11
  16. package/.claude/commands/docs/update.md +0 -11
  17. package/.claude/commands/fix/ci.md +0 -8
  18. package/.claude/commands/fix/fast.md +0 -5
  19. package/.claude/commands/fix/hard.md +0 -7
  20. package/.claude/commands/fix/test.md +0 -16
  21. package/.claude/commands/git/cm.md +0 -5
  22. package/.claude/commands/git/cp.md +0 -4
  23. package/.claude/commands/plan/ci.md +0 -12
  24. package/.claude/commands/plan/two.md +0 -13
  25. package/.claude/commands/plan.md +0 -10
  26. package/.claude/commands/test.md +0 -7
  27. package/.claude/commands/watzup.md +0 -8
  28. package/.claude/hooks/telegram_notify.sh +0 -136
  29. package/.claude/send-discord.sh +0 -64
  30. package/.claude/settings.json +0 -7
  31. package/.claude/statusline.sh +0 -143
  32. package/.dockerignore +0 -81
  33. package/.env.example +0 -44
  34. package/.github/workflows/publish.yml +0 -88
  35. package/.opencode/agent/code-reviewer.md +0 -142
  36. package/.opencode/agent/debugger.md +0 -74
  37. package/.opencode/agent/docs-manager.md +0 -119
  38. package/.opencode/agent/git-manager.md +0 -60
  39. package/.opencode/agent/planner-researcher.md +0 -100
  40. package/.opencode/agent/project-manager.md +0 -113
  41. package/.opencode/agent/system-architecture.md +0 -200
  42. package/.opencode/agent/tester.md +0 -96
  43. package/.opencode/agent/ui-ux-developer.md +0 -97
  44. package/.opencode/command/cook.md +0 -7
  45. package/.opencode/command/debug.md +0 -10
  46. package/.opencode/command/fix/ci.md +0 -8
  47. package/.opencode/command/fix/fast.md +0 -5
  48. package/.opencode/command/fix/hard.md +0 -7
  49. package/.opencode/command/fix/test.md +0 -16
  50. package/.opencode/command/git/cm.md +0 -5
  51. package/.opencode/command/git/cp.md +0 -4
  52. package/.opencode/command/plan/ci.md +0 -12
  53. package/.opencode/command/plan/two.md +0 -13
  54. package/.opencode/command/plan.md +0 -10
  55. package/.opencode/command/test.md +0 -7
  56. package/.opencode/command/watzup.md +0 -8
  57. package/.releaserc.json +0 -26
  58. package/.serena/project.yml +0 -68
  59. package/CHANGELOG.md +0 -62
  60. package/CLAUDE.md +0 -141
  61. package/DEPLOYMENT.md +0 -329
  62. package/Dockerfile +0 -52
  63. package/QUICKSTART.md +0 -97
  64. package/bun.lock +0 -1872
  65. package/bunfig.toml +0 -15
  66. package/docker-compose.yaml +0 -128
  67. package/docs/README.md +0 -51
  68. package/docs/codebase-structure-architecture-code-standards.md +0 -428
  69. package/docs/codebase-summary.md +0 -321
  70. package/docs/project-overview-pdr.md +0 -286
  71. package/docs/project-roadmap.md +0 -494
  72. package/examples/debugging-session.ts +0 -96
  73. package/human-mcp.png +0 -0
  74. package/inspector-wrapper.mjs +0 -33
  75. package/plans/001-streamable-http-transport-plan.md +0 -905
  76. package/plans/002-sse-fallback-http-transport-plan.md +0 -161
  77. package/plans/003-fix-test-infrastructure-and-ci-plan.md +0 -699
  78. package/plans/003-http-transport-local-file-access-plan.md +0 -880
  79. package/plans/004-fix-typescript-compilation-errors-plan.md +0 -388
  80. package/plans/005-comprehensive-test-infrastructure-fix-plan.md +0 -854
  81. package/plans/templates/bug-fix-template.md +0 -69
  82. package/plans/templates/feature-implementation-template.md +0 -84
  83. package/plans/templates/refactor-template.md +0 -82
  84. package/plans/templates/template-usage-guide.md +0 -58
  85. package/src/index.ts +0 -49
  86. package/src/prompts/debugging-prompts.ts +0 -149
  87. package/src/prompts/index.ts +0 -55
  88. package/src/resources/documentation.ts +0 -316
  89. package/src/resources/index.ts +0 -49
  90. package/src/server.ts +0 -36
  91. package/src/tools/eyes/index.ts +0 -225
  92. package/src/tools/eyes/processors/gif.ts +0 -137
  93. package/src/tools/eyes/processors/image.ts +0 -213
  94. package/src/tools/eyes/processors/video.ts +0 -135
  95. package/src/tools/eyes/schemas.ts +0 -51
  96. package/src/tools/eyes/utils/formatters.ts +0 -126
  97. package/src/tools/eyes/utils/gemini-client.ts +0 -73
  98. package/src/transports/http/file-interceptor.ts +0 -134
  99. package/src/transports/http/middleware.ts +0 -46
  100. package/src/transports/http/routes.ts +0 -297
  101. package/src/transports/http/server.ts +0 -116
  102. package/src/transports/http/session.ts +0 -93
  103. package/src/transports/http/sse-routes.ts +0 -210
  104. package/src/transports/index.ts +0 -36
  105. package/src/transports/stdio.ts +0 -7
  106. package/src/transports/types.ts +0 -50
  107. package/src/types/index.ts +0 -41
  108. package/src/utils/cloudflare-r2.ts +0 -107
  109. package/src/utils/config.ts +0 -123
  110. package/src/utils/errors.ts +0 -40
  111. package/src/utils/logger.ts +0 -49
  112. package/tests/integration/http-transport-files.test.ts +0 -190
  113. package/tests/integration/server.test.ts +0 -27
  114. package/tests/integration/sse-transport.test.ts +0 -142
  115. package/tests/setup.ts +0 -55
  116. package/tests/types/api-responses.ts +0 -35
  117. package/tests/types/test-types.ts +0 -105
  118. package/tests/unit/cloudflare-r2.test.ts +0 -118
  119. package/tests/unit/config.test.ts +0 -40
  120. package/tests/unit/eyes-analyze.test.ts +0 -150
  121. package/tests/unit/formatters.test.ts +0 -85
  122. package/tests/unit/sse-routes.test.ts +0 -92
  123. package/tests/utils/error-scenarios.ts +0 -198
  124. package/tests/utils/index.ts +0 -3
  125. package/tests/utils/mock-helpers.ts +0 -99
  126. package/tests/utils/test-data-generators.ts +0 -217
  127. package/tests/utils/test-server-manager.ts +0 -172
  128. package/tsconfig.json +0 -26
@@ -1,69 +0,0 @@
1
- # [Bug Fix] Implementation Plan
2
-
3
- **Date**: YYYY-MM-DD
4
- **Type**: Bug Fix
5
- **Priority**: [Critical/High/Medium/Low]
6
- **Context Tokens**: <150 words
7
-
8
- ## Executive Summary
9
- Brief description of the bug and its impact.
10
-
11
- ## Issue Analysis
12
- ### Symptoms
13
- - [ ] Symptom 1
14
- - [ ] Symptom 2
15
-
16
- ### Root Cause
17
- Brief explanation of the underlying cause.
18
-
19
- ### Evidence
20
- - **Logs**: Reference to log files (don't include full logs)
21
- - **Error Messages**: Key error patterns
22
- - **Affected Components**: List of impacted files/modules
23
-
24
- ## Context Links
25
- - **Related Issues**: [GitHub issue numbers]
26
- - **Recent Changes**: [Relevant commits or PRs]
27
- - **Dependencies**: [Related systems]
28
-
29
- ## Solution Design
30
- ### Approach
31
- High-level fix strategy in 2-3 sentences.
32
-
33
- ### Changes Required
34
- 1. **File 1** (`path/to/file.ts`): Brief change description
35
- 2. **File 2** (`path/to/file.ts`): Brief change description
36
-
37
- ### Testing Changes
38
- - [ ] Update existing tests
39
- - [ ] Add new test cases
40
- - [ ] Validate fix doesn't break existing functionality
41
-
42
- ## Implementation Steps
43
- 1. [ ] Step 1 - file: `path/to/file.ts`
44
- 2. [ ] Step 2 - file: `path/to/file.ts`
45
- 3. [ ] Run test suite
46
- 4. [ ] Validate fix in relevant environments
47
-
48
- ## Verification Plan
49
- ### Test Cases
50
- - [ ] Test case 1: Expected behavior
51
- - [ ] Test case 2: Edge case handling
52
- - [ ] Regression test: Ensure no new issues
53
-
54
- ### Rollback Plan
55
- If the fix causes issues:
56
- 1. Revert commit: `git revert <commit-hash>`
57
- 2. Restore previous behavior in files X, Y, Z
58
-
59
- ## Risk Assessment
60
- | Risk | Impact | Mitigation |
61
- |------|--------|------------|
62
- | Risk 1 | Medium | Mitigation plan |
63
-
64
- ## TODO Checklist
65
- - [ ] Implement fix
66
- - [ ] Update tests
67
- - [ ] Run full test suite
68
- - [ ] Code review
69
- - [ ] Deploy and verify
@@ -1,84 +0,0 @@
1
- # [Feature Name] Implementation Plan
2
-
3
- **Date**: YYYY-MM-DD
4
- **Type**: Feature Implementation
5
- **Status**: Planning
6
- **Context Tokens**: <200 words
7
-
8
- ## Executive Summary
9
- Brief 2-3 sentence description of the feature and its business value.
10
-
11
- ## Context Links
12
- - **Related Plans**: [List other plan files - no full content]
13
- - **Dependencies**: [External systems, APIs, existing features]
14
- - **Reference Docs**: [Link to docs in ./docs directory]
15
-
16
- ## Requirements
17
- ### Functional Requirements
18
- - [ ] Requirement 1
19
- - [ ] Requirement 2
20
-
21
- ### Non-Functional Requirements
22
- - [ ] Performance target
23
- - [ ] Security requirement
24
- - [ ] Scalability requirement
25
-
26
- ## Architecture Overview
27
- ```mermaid
28
- [Simple component diagram]
29
- ```
30
-
31
- ### Key Components
32
- - **Component 1**: Brief description
33
- - **Component 2**: Brief description
34
-
35
- ### Data Models
36
- - **Model 1**: Key fields
37
- - **Model 2**: Key fields
38
-
39
- ## Implementation Phases
40
-
41
- ### Phase 1: [Name] (Est: X days)
42
- **Scope**: Specific boundaries
43
- **Tasks**:
44
- 1. [ ] Task 1 - file: `path/to/file.ts`
45
- 2. [ ] Task 2 - file: `path/to/file.ts`
46
-
47
- **Acceptance Criteria**:
48
- - [ ] Criteria 1
49
- - [ ] Criteria 2
50
-
51
- ### Phase 2: [Name] (Est: X days)
52
- [Repeat structure]
53
-
54
- ## Testing Strategy
55
- - **Unit Tests**: Specific test coverage targets
56
- - **Integration Tests**: Key interaction points
57
- - **E2E Tests**: Critical user flows
58
-
59
- ## Security Considerations
60
- - [ ] Security item 1
61
- - [ ] Security item 2
62
-
63
- ## Risk Assessment
64
- | Risk | Impact | Mitigation |
65
- |------|--------|------------|
66
- | Risk 1 | High | Mitigation strategy |
67
-
68
- ## Quick Reference
69
- ### Key Commands
70
- ```bash
71
- npm run command
72
- ```
73
-
74
- ### Configuration Files
75
- - `config/file.ts`: Purpose
76
- - `.env.example`: Environment variables
77
-
78
- ## TODO Checklist
79
- - [ ] Phase 1 Task 1
80
- - [ ] Phase 1 Task 2
81
- - [ ] Phase 2 Task 1
82
- - [ ] Testing complete
83
- - [ ] Documentation updated
84
- - [ ] Code review passed
@@ -1,82 +0,0 @@
1
- # [Component/Module] Refactoring Plan
2
-
3
- **Date**: YYYY-MM-DD
4
- **Type**: Refactoring
5
- **Scope**: [Module/Component/System level]
6
- **Context Tokens**: <200 words
7
-
8
- ## Executive Summary
9
- Brief description of what is being refactored and why.
10
-
11
- ## Current State Analysis
12
- ### Issues with Current Implementation
13
- - [ ] Issue 1: Performance bottleneck
14
- - [ ] Issue 2: Code maintainability
15
- - [ ] Issue 3: Technical debt
16
-
17
- ### Metrics (Before)
18
- - **Performance**: Current benchmarks
19
- - **Code Quality**: Complexity metrics
20
- - **Test Coverage**: Current percentage
21
-
22
- ## Context Links
23
- - **Affected Modules**: [List without full content]
24
- - **Dependencies**: [Other systems impacted]
25
- - **Related Documentation**: [Links to docs]
26
-
27
- ## Refactoring Strategy
28
- ### Approach
29
- High-level strategy for the refactoring in 2-3 sentences.
30
-
31
- ### Architecture Changes
32
- ```mermaid
33
- [Before/After comparison diagram]
34
- ```
35
-
36
- ### Key Improvements
37
- - **Improvement 1**: Brief description
38
- - **Improvement 2**: Brief description
39
-
40
- ## Implementation Plan
41
-
42
- ### Phase 1: Preparation (Est: X days)
43
- **Scope**: Setup and preparation work
44
- 1. [ ] Create comprehensive tests for current functionality
45
- 2. [ ] Document current behavior
46
- 3. [ ] Identify all dependencies
47
-
48
- ### Phase 2: Core Refactoring (Est: X days)
49
- **Scope**: Main refactoring work
50
- 1. [ ] Refactor component A - file: `path/to/file.ts`
51
- 2. [ ] Refactor component B - file: `path/to/file.ts`
52
- 3. [ ] Update integration points
53
-
54
- ### Phase 3: Integration & Testing (Est: X days)
55
- **Scope**: Validation and cleanup
56
- 1. [ ] Integration testing
57
- 2. [ ] Performance validation
58
- 3. [ ] Documentation updates
59
-
60
- ## Backward Compatibility
61
- - **Breaking Changes**: [List any breaking changes]
62
- - **Migration Path**: [Steps for users/systems]
63
- - **Deprecation Timeline**: [If applicable]
64
-
65
- ## Success Metrics (After)
66
- - **Performance**: Target improvements
67
- - **Code Quality**: Target metrics
68
- - **Test Coverage**: Target percentage
69
-
70
- ## Risk Assessment
71
- | Risk | Impact | Mitigation |
72
- |------|--------|------------|
73
- | Breaking changes | High | Comprehensive testing |
74
- | Performance regression | Medium | Benchmarking |
75
-
76
- ## TODO Checklist
77
- - [ ] Phase 1: Preparation complete
78
- - [ ] Phase 2: Core refactoring complete
79
- - [ ] Phase 3: Integration complete
80
- - [ ] Performance benchmarks validated
81
- - [ ] Documentation updated
82
- - [ ] Code review passed
@@ -1,58 +0,0 @@
1
- # Plan Template Usage Guide
2
-
3
- ## Template Selection
4
-
5
- ### Feature Implementation Template
6
- **Use when**: Adding new functionality, endpoints, services, or modules
7
- **File**: `feature-implementation-template.md`
8
- **Size**: Medium to large scope changes
9
-
10
- ### Bug Fix Template
11
- **Use when**: Fixing specific issues, errors, or broken functionality
12
- **File**: `bug-fix-template.md`
13
- **Size**: Small to medium scope changes
14
-
15
- ### Refactoring Template
16
- **Use when**: Improving code structure, performance, or maintainability without changing functionality
17
- **File**: `refactor-template.md`
18
- **Size**: Medium to large scope changes
19
-
20
- ## Context Management Best Practices
21
-
22
- ### Keep Plans Focused
23
- - **Executive Summary**: Max 3 sentences
24
- - **Context Links**: Reference files, don't include full content
25
- - **Tasks**: Max 10 per phase
26
- - **Context Tokens**: Target <200 words for summaries
27
-
28
- ### Template Adaptation
29
- 1. Copy the appropriate template to `plans/NNN-feature-name-plan.md`
30
- 2. Replace bracketed placeholders with actual content
31
- 3. Remove sections not relevant to your specific use case
32
- 4. Keep the core structure intact for consistency
33
-
34
- ### Cross-References Instead of Duplication
35
- - Link to existing documentation in `./docs/`
36
- - Reference other plans without copying content
37
- - Use file paths instead of code blocks where possible
38
- - Focus on "what" and "why", not detailed "how"
39
-
40
- ## Quality Checklist
41
-
42
- Before finalizing any plan:
43
- - [ ] Executive summary is clear and concise
44
- - [ ] Tasks are specific and actionable
45
- - [ ] File paths are included for implementation tasks
46
- - [ ] Success criteria are measurable
47
- - [ ] Context links are used instead of full content
48
- - [ ] TODO checklist is complete and realistic
49
-
50
- ## Context Refresh Triggers
51
-
52
- Use these templates when:
53
- - Starting a new development phase
54
- - Switching between different types of work (feature → bugfix)
55
- - After major context accumulation (>8000 tokens)
56
- - When agent handoffs occur
57
-
58
- This ensures each plan starts with fresh, focused context optimized for the specific task type.
package/src/index.ts DELETED
@@ -1,49 +0,0 @@
1
- #!/usr/bin/env bun
2
-
3
- import { createServer } from "./server.js";
4
- import { TransportManager } from "./transports/index.js";
5
- import { loadConfig } from "./utils/config.js";
6
- import { logger } from "./utils/logger.js";
7
-
8
- async function main() {
9
- try {
10
- const config = loadConfig();
11
- const server = await createServer();
12
-
13
- const transportConfig = {
14
- type: config.transport.type,
15
- http: config.transport.http?.enabled ? {
16
- port: config.transport.http.port,
17
- host: config.transport.http.host,
18
- sessionMode: config.transport.http.sessionMode,
19
- enableSse: config.transport.http.enableSse,
20
- enableJsonResponse: config.transport.http.enableJsonResponse,
21
- enableSseFallback: config.transport.http.enableSseFallback,
22
- ssePaths: config.transport.http.ssePaths,
23
- security: config.transport.http.security
24
- } : undefined
25
- };
26
-
27
- const transportManager = new TransportManager(server, transportConfig);
28
- await transportManager.start();
29
-
30
- logger.info(`Human MCP Server started with ${config.transport.type} transport`);
31
-
32
- // Graceful shutdown
33
- process.on('SIGINT', async () => {
34
- logger.info('Shutting down server...');
35
- process.exit(0);
36
- });
37
-
38
- process.on('SIGTERM', async () => {
39
- logger.info('Shutting down server...');
40
- process.exit(0);
41
- });
42
-
43
- } catch (error) {
44
- logger.error('Failed to start server:', error);
45
- process.exit(1);
46
- }
47
- }
48
-
49
- main();
@@ -1,149 +0,0 @@
1
- export const debuggingPrompts = [
2
- {
3
- name: "debug_ui_screenshot",
4
- title: "Debug UI Screenshot",
5
- description: "Analyze a UI screenshot to identify layout issues, misalignments, or rendering problems",
6
- arguments: [
7
- {
8
- name: "screenshot",
9
- description: "The screenshot to analyze",
10
- required: true
11
- },
12
- {
13
- name: "expected_behavior",
14
- description: "Description of expected UI behavior",
15
- required: false
16
- }
17
- ],
18
- template: `Analyze this UI screenshot for debugging:
19
- Screenshot: {{screenshot}}
20
- Expected behavior: {{expected_behavior}}
21
-
22
- Please identify:
23
- 1. Any visible errors or anomalies
24
- 2. Layout or alignment issues
25
- 3. Missing or broken elements
26
- 4. Accessibility concerns
27
- 5. Performance indicators
28
-
29
- Use the eyes.analyze tool with analysis_type="ui_debug" to get detailed insights.`
30
- },
31
- {
32
- name: "analyze_error_recording",
33
- title: "Analyze Error Recording",
34
- description: "Analyze a screen recording to understand when and how an error occurs",
35
- arguments: [
36
- {
37
- name: "recording",
38
- description: "Video recording of the error",
39
- required: true
40
- },
41
- {
42
- name: "error_description",
43
- description: "Description of the error",
44
- required: true
45
- }
46
- ],
47
- template: `Analyze this screen recording to debug an error:
48
- Recording: {{recording}}
49
- Error description: {{error_description}}
50
-
51
- Focus on:
52
- 1. The sequence of events leading to the error
53
- 2. Visual cues indicating the problem
54
- 3. UI state changes
55
- 4. Potential root causes
56
- 5. Reproduction steps
57
-
58
- Use the eyes.analyze tool with analysis_type="error_detection" and type="video" for comprehensive analysis.`
59
- },
60
- {
61
- name: "accessibility_audit",
62
- title: "Accessibility Audit",
63
- description: "Perform a visual accessibility audit of a UI screenshot",
64
- arguments: [
65
- {
66
- name: "screenshot",
67
- description: "Screenshot of the UI to audit",
68
- required: true
69
- },
70
- {
71
- name: "focus_areas",
72
- description: "Specific accessibility areas to focus on",
73
- required: false
74
- }
75
- ],
76
- template: `Perform an accessibility audit of this UI:
77
- Screenshot: {{screenshot}}
78
- Focus areas: {{focus_areas}}
79
-
80
- Analyze for:
81
- 1. Color contrast ratios
82
- 2. Text readability
83
- 3. Focus indicators
84
- 4. Alternative text presence
85
- 5. WCAG compliance issues
86
- 6. Keyboard navigation support
87
-
88
- Use the eyes.analyze tool with analysis_type="accessibility" and check_accessibility=true.`
89
- },
90
- {
91
- name: "performance_visual_audit",
92
- title: "Performance Visual Audit",
93
- description: "Analyze a screenshot for visual performance indicators",
94
- arguments: [
95
- {
96
- name: "screenshot",
97
- description: "Screenshot showing performance metrics or loading states",
98
- required: true
99
- }
100
- ],
101
- template: `Analyze this screenshot for performance issues:
102
- Screenshot: {{screenshot}}
103
-
104
- Look for:
105
- 1. Loading indicators and their appropriateness
106
- 2. Layout shift evidence
107
- 3. Render blocking signs
108
- 4. Large unoptimized images
109
- 5. Performance metric readings
110
- 6. Visual indicators of slow responses
111
-
112
- Use the eyes.analyze tool with analysis_type="performance".`
113
- },
114
- {
115
- name: "layout_comparison",
116
- title: "Layout Comparison",
117
- description: "Compare two UI layouts to identify differences",
118
- arguments: [
119
- {
120
- name: "layout1",
121
- description: "First layout screenshot",
122
- required: true
123
- },
124
- {
125
- name: "layout2",
126
- description: "Second layout screenshot",
127
- required: true
128
- },
129
- {
130
- name: "comparison_context",
131
- description: "Context for the comparison (e.g., before/after, desktop/mobile)",
132
- required: false
133
- }
134
- ],
135
- template: `Compare these two layouts:
136
- Layout 1: {{layout1}}
137
- Layout 2: {{layout2}}
138
- Context: {{comparison_context}}
139
-
140
- Identify:
141
- 1. Structural differences
142
- 2. Element positioning changes
143
- 3. Spacing and alignment variations
144
- 4. Responsive design issues
145
- 5. Visual hierarchy changes
146
-
147
- Use the eyes.compare tool with comparison_type="structural".`
148
- }
149
- ];
@@ -1,55 +0,0 @@
1
- import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
- import { z } from "zod";
3
- import { debuggingPrompts } from "./debugging-prompts.js";
4
- import { logger } from "@/utils/logger.js";
5
-
6
- export async function registerPrompts(server: McpServer) {
7
- // Register each debugging prompt
8
- for (const prompt of debuggingPrompts) {
9
- // Build zod schema for arguments
10
- const argsSchema: Record<string, z.ZodTypeAny> = {};
11
- for (const arg of prompt.arguments) {
12
- if (arg.required) {
13
- argsSchema[arg.name] = z.string().describe(arg.description);
14
- } else {
15
- argsSchema[arg.name] = z.string().optional().describe(arg.description);
16
- }
17
- }
18
-
19
- logger.debug(`Registering prompt: ${prompt.name}`);
20
-
21
- server.registerPrompt(
22
- prompt.name,
23
- {
24
- title: prompt.title,
25
- description: prompt.description,
26
- argsSchema
27
- },
28
- (args) => {
29
- logger.debug(`Getting prompt: ${prompt.name}`);
30
-
31
- let content = prompt.template;
32
-
33
- // Replace template variables
34
- if (args) {
35
- for (const [key, value] of Object.entries(args)) {
36
- const placeholder = `{{${key}}}`;
37
- content = content.replace(new RegExp(placeholder, 'g'), String(value));
38
- }
39
- }
40
-
41
- return {
42
- messages: [
43
- {
44
- role: "user",
45
- content: {
46
- type: "text",
47
- text: content
48
- }
49
- }
50
- ]
51
- };
52
- }
53
- );
54
- }
55
- }