-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Summary
Add the ability to get/execute prompts with arguments, not just list them.
Background
Currently Anvil can list available prompts but cannot retrieve prompt content with arguments. The MCP protocol supports prompts/get to fetch rendered prompt content.
Proposed Implementation
CLI
# Get a prompt (no arguments)
anvil get-prompt "code-review"
# Get a prompt with arguments
anvil get-prompt "code-review" --arg language=python --arg style=detailed
# With JSON arguments
anvil get-prompt "summarize" --json-args '{"text": "...", "length": "short"}'
# JSON output
anvil get-prompt "code-review" --jsonWeb UI
- Add "Get" or "Execute" button for each prompt in the list
- When clicked, show a form with argument fields (similar to tools)
- Display the rendered prompt content (messages array)
- Include description and any metadata
Technical Implementation
async def get_prompt(self, name: str, arguments: dict[str, str] | None = None) -> dict[str, Any]:
"""Get prompt content with optional arguments."""
async with Client(self.server_url) as client:
result = await client.get_prompt(name, arguments or {})
return {
"description": result.description,
"messages": [
{
"role": msg.role,
"content": _content_to_list(msg.content),
}
for msg in result.messages
],
}Acceptance Criteria
- CLI command
anvil get-prompt <name>implemented - Support for
--arg key=valuearguments - Support for
--json-argsfor complex arguments - Web UI shows argument form based on prompt schema
- Rendered messages displayed clearly
- Error handling for missing required arguments
References
- MCP prompts/get spec: https://spec.modelcontextprotocol.io/specification/server/prompts/#getting-a-prompt
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request