tightening
This commit is contained in:
@@ -2,8 +2,6 @@ import re
|
||||
from collections.abc import Mapping
|
||||
from pathlib import PurePosixPath
|
||||
from typing import TYPE_CHECKING
|
||||
from typing import Any
|
||||
from typing import Literal
|
||||
|
||||
import yaml
|
||||
from pydantic import Field
|
||||
@@ -18,31 +16,13 @@ from .common import frozen_mapping
|
||||
if TYPE_CHECKING:
|
||||
from personal_mcp.registry.ingest.prompt import PromptFilesBundle
|
||||
|
||||
type PromptArgumentType = Literal[
|
||||
"string",
|
||||
"number",
|
||||
"integer",
|
||||
"boolean",
|
||||
"array",
|
||||
"object",
|
||||
]
|
||||
|
||||
|
||||
class PromptArgumentEntry(StrictFrozenModel):
|
||||
"""Schema for a single prompt argument definition."""
|
||||
|
||||
type: PromptArgumentType
|
||||
title: str | None = None
|
||||
description: str | None = None
|
||||
required: bool = False
|
||||
default: Any | None = None
|
||||
enum: tuple[str, ...] | None = None
|
||||
|
||||
@field_validator("enum")
|
||||
@classmethod
|
||||
def validate_enum(cls, value: tuple[str, ...] | None) -> tuple[str, ...] | None:
|
||||
if value is not None and not value:
|
||||
raise ValueError("enum must contain at least one value when provided")
|
||||
return value
|
||||
|
||||
|
||||
class PromptMetadata(StrictFrozenModel):
|
||||
|
||||
Reference in New Issue
Block a user