2.5 KiB
2.5 KiB
icon
| icon |
|---|
| lucide/messages-square |
Prompt Contract
This page defines the canonical contract for typed prompts discovered by FastMCP's FileSystemProvider.
Canonical Prompt Shape
Each prompt has a Python component and one canonical Markdown document:
---
config:
treeView:
rowIndent: 20
lineThickness: 2
themeVariables:
treeView:
labelColor: '#FFFFFF'
lineColor: '#FFFFFF'
---
treeView-beta
"src/personal_mcp/prompts/"
"components/"
"<prompt_module>.py"
"content.py"
"provider.py"
"docs/prompts/"
"<prompt-id>/"
"PROMPT.md"
Rules:
- Each component exports one typed function decorated with
@prompt. - Function parameters define the MCP argument names, requiredness, and accepted values.
- Decorator fields define runtime name, description, tags, and version.
- The function loads its matching
docs/prompts/<prompt-id>/PROMPT.mdthroughimportlib.resources. PROMPT.mdowns the rendered prompt prose and uses{argument_name}placeholders.- The renderer requires exact equality between the function's arguments and the Markdown placeholders.
Ownership Boundary
- Python owns runtime metadata and the callable schema.
- Markdown owns prompt prose and may contain only documentation-site frontmatter.
- There is no custom prompt catalog, prompt registry model, or metadata sidecar.
FileSystemProvider(reload=False)discovers components when the server is created.
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
@promptname and Markdown directory name must equalprompt-id. - 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 renderer strips one leading YAML frontmatter block before returning prompt content.
- Required values are supplied by the typed function signature.
- An omitted optional value renders as
Not provided. - Unknown prompt ids and mismatched placeholders fail immediately.
- Prompt content is read from packaged resources and does not depend on the working directory.