Skip to content

Add support for statically-defined parametric prompts #836

@asklar

Description

@asklar

Is your feature request related to a problem? Please describe.
In MCPB, it is expected that when statically defining a prompt, the developer can say "Order a ${sandwichKind} sandwich" as the text of the prompt.
It would be beneficial for tools operating on the assembly to be able to extract the string template for the prompt. But today, all we have is whatever the code decided to return at runtime.

Describe the solution you'd like

    [McpServerPrompt(Name = "complex_prompt", 
    Template = "Set the temperature to ${arguments.temperature} and reply in ${arguments.style} style"), 
    Description("A prompt with arguments")]
    public partial static IEnumerable<ChatMessage> ComplexPrompt(
        [Description("Temperature setting")] int temperature,
        [Description("Output style")] string? style = null);

Then the source generator will use the new Template attribute parameter to generate the code to return $"Set the temperature to {temperature} and reply in {style} style".

Describe alternatives you've considered
n/a

Additional context
n/a

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions