Abstract base for rendering prompts with arguments.
# Source: https://github.com/hoangsonww/AI-RAG-Assistant-Chatbot | License: MIT | Copyright 2026 Son Nguyen
# Provided via justclaw.it.com; keep this notice with the code.
"""
Base class for prompt handlers.
"""
from __future__ import annotations
from abc import ABC, abstractmethod
from typing import Dict
import mcp.types as types
class PromptHandler(ABC):
"""Wraps a single MCP prompt template."""
def __init__(self, definition: types.Prompt) -> None:
self._definition = definition
@property
def definition(self) -> types.Prompt:
return self._definition
@property
def name(self) -> str:
return self._definition.name
@abstractmethod
async def render(self, arguments: Dict[str, str]) -> types.GetPromptResult:
"""Render the pr
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key