2.9 KiB
2.9 KiB
icon
| icon |
|---|
| lucide/messages-square |
Prompt Contract
This page defines the canonical contract for declarative prompts published through a custom FastMCP provider.
Canonical Prompt Shape
Each prompt is one self-describing Markdown document:
---
config:
treeView:
rowIndent: 20
lineThickness: 2
themeVariables:
treeView:
labelColor: '#FFFFFF'
lineColor: '#FFFFFF'
---
treeView-beta
"docs/prompts/"
"<prompt-id>/"
"PROMPT.md"
"src/personal_mcp/prompts/"
"content.py"
"models.py"
"provider.py"
Rules:
- The parent directory name defines the public prompt id.
- The nested
promptfrontmatter block defines version, description, tags, and arguments. - Argument declarations define names, descriptions, requiredness, and optional string choices.
- The Markdown body owns the rendered prompt prose and uses
{{argument_name}}placeholders. - Declared arguments and body placeholders must match exactly.
- No Python file is added when authoring a prompt.
Ownership Boundary
- Each
PROMPT.mdowns both its runtime metadata and prose. - Python owns only generic parsing, validation, rendering, and provider behavior.
- There is no central prompt catalog, generated signature, or metadata sidecar.
- The provider scans direct children of packaged
docs/prompts/on each list or get request. - Additions, edits, and deletions become visible on the next request without restarting the server.
- Reload is pull-based; the provider does not watch files or emit proactive change notifications.
Prompt Id Contract
prompt-id is the public identifier and should satisfy all rules below:
- Format: lowercase kebab-case only.
- Character set:
a-z,0-9, and-. - Must start with a letter.
- No underscores, spaces, dots, or uppercase characters.
- Directory name should equal
prompt-idin each committed revision. - The provider derives the prompt name from the directory; frontmatter must not duplicate it.
- Treat
prompt-idas immutable after release; a rename is a breaking replacement.
Valid examples:
pytest-fill-scaffoldreview-pr-commentsscaffold-fastapi-service
Invalid examples:
fill_pytest_scaffoldPrompt-Templatedocs.prompt
Rendering Contract
- The loader requires one leading YAML frontmatter block and validates its nested
promptmapping strictly. - All MCP arguments are strings;
choicesoptionally restricts accepted values. - Missing required arguments, unknown arguments, and invalid choices fail before rendering.
- An omitted optional value renders as
Not provided. - Unknown prompt ids, malformed metadata, and mismatched placeholders fail immediately.
- Prompt content is read through importlib resources and does not depend on the working directory.