Skip to content

feat: add parameterless prompt execution support with defaults and auto-generated values#126

Open
Sean-Sekora wants to merge 4 commits intoQuantGeekDev:mainfrom
Sean-Sekora:main
Open

feat: add parameterless prompt execution support with defaults and auto-generated values#126
Sean-Sekora wants to merge 4 commits intoQuantGeekDev:mainfrom
Sean-Sekora:main

Conversation

@Sean-Sekora
Copy link
Copy Markdown

Key Features Added

1. Enhanced Schema Support

  • Add default property to PromptArgumentSchema for explicit default values
  • Support for parameterless prompt execution with sensible defaults

2. Improved Parameter Handling

  • MCPServer now passes empty object when arguments are undefined
  • BasePrompt gracefully handles missing arguments with automatic defaults
  • Automatic type-based defaults: string="", number=0, boolean=false, array=[], object={}

3. Smart Validation Logic

  • Fields with explicit defaults are marked as not required in prompt definitions
  • Optional parameters (required: false) bypass validation requirements
  • Maintains full backward compatibility with existing prompts

4. Comprehensive Testing

  • 12 test cases covering all parameterless execution scenarios
  • Tests for explicit defaults, automatic defaults, and optional parameters
  • Error handling and edge case validation

5. Rich Documentation

  • Complete Prompts section in README with examples and best practices
  • Migration guide for existing prompts
  • Usage patterns for different parameter configurations

Breaking Changes

None - fully backward compatible

Usage Examples

Before: /my-prompt (MCP) {"message": ""} (required empty object)
After: /my-prompt (MCP) (truly parameterless execution)

This enables natural prompt usage like /gitlab:commit (MCP) without requiring empty JSON objects.

🤖 Generated with Claude Code

Sean-Sekora and others added 4 commits October 6, 2025 23:35
…to-generated values

## Key Features Added

### 1. Enhanced Schema Support
- Add `default` property to PromptArgumentSchema for explicit default values
- Support for parameterless prompt execution with sensible defaults

### 2. Improved Parameter Handling
- MCPServer now passes empty object when arguments are undefined
- BasePrompt gracefully handles missing arguments with automatic defaults
- Automatic type-based defaults: string="", number=0, boolean=false, array=[], object={}

### 3. Smart Validation Logic
- Fields with explicit defaults are marked as not required in prompt definitions
- Optional parameters (required: false) bypass validation requirements
- Maintains full backward compatibility with existing prompts

### 4. Comprehensive Testing
- 12 test cases covering all parameterless execution scenarios
- Tests for explicit defaults, automatic defaults, and optional parameters
- Error handling and edge case validation

### 5. Rich Documentation
- Complete Prompts section in README with examples and best practices
- Migration guide for existing prompts
- Usage patterns for different parameter configurations

## Breaking Changes
None - fully backward compatible

## Usage Examples

**Before**: `/my-prompt (MCP) {"message": ""}` (required empty object)
**After**: `/my-prompt (MCP)` (truly parameterless execution)

This enables natural prompt usage like `/gitlab:commit (MCP)` without requiring empty JSON objects.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Update package name to @sekora/mcp-framework for scoped npm publishing
- Add publish.yml workflow that triggers on GitHub releases and manual dispatch
- Include comprehensive CI steps: linting, testing, building before publishing
- Support manual version updates and automatic npm publishing with public access
- Enhance release.yml workflow with outputs for better integration

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
…--components--mcp-framework

chore: release 0.2.16
@QuantGeekDev
Copy link
Copy Markdown
Owner

Hey @Sean-Sekora, thanks for putting this together — the parameterless prompt execution concept is interesting and the tests you wrote are solid!

We did a thorough review and wanted to share some feedback. There are a few issues that would need to be addressed before we could merge this:

Blockers

  1. Package renamepackage.json changes the name from mcp-framework to @sekora/mcp-framework. This would break all existing consumers.

  2. Release manifest & changelog — The .release-please-manifest.json is bumped to 0.2.16 but we're on 0.2.18 now. The CHANGELOG.md also has the entire fork commit history dumped in, which would pollute the upstream changelog.

  3. Publish workflow — The new publish.yml conflicts with our existing Release Please setup and uses the deprecated actions/create-release@v1.

  4. PR branch — This PR is from your fork's main branch rather than a feature branch, which is why the diff includes all the unrelated changes above.

Feature feedback

The core prompt changes have some good ideas but also some concerns:

  • Explicit default property ✅ — Adding a default field to PromptArgumentSchema is a clean idea and we'd be open to it.

  • Auto-generated defaults ❌ — The logic that auto-generates values based on Zod type (string → "", number → 0, etc.) is risky. A prompt expecting a commit message or project ID would silently get an empty string instead of erroring. This masks bugs rather than surfacing them, and isn't something the MCP spec defines — if a required argument is missing, the correct behavior is to fail with a clear error.

  • The arguments || {} fix in MCPServer.ts ✅ — This one-liner is valid and we'd accept it as a standalone fix.

Suggestion

If you'd like to rework this, a clean PR from a feature branch with just these changes would be very welcome:

  1. The default property on PromptArgumentSchema (explicit defaults only, no auto-generation)
  2. The arguments || {} null-safety fix in MCPServer.ts
  3. Updated required logic that marks fields with explicit defaults as not required

That would be a focused, mergeable change. Would you be interested in doing that, or would you like us to take it from here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants