mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-24 06:24:18 +02:00
Add meta parameter support to tools, resources, templates, and prompts decorators (#1294)
This commit is contained in:
parent
7705858266
commit
3fc2510110
13 changed files with 192 additions and 2 deletions
|
|
@ -65,7 +65,8 @@ While FastMCP infers the name and description from your function, you can overri
|
|||
@mcp.prompt(
|
||||
name="analyze_data_request", # Custom prompt name
|
||||
description="Creates a request to analyze data with specific parameters", # Custom description
|
||||
tags={"analysis", "data"} # Optional categorization tags
|
||||
tags={"analysis", "data"}, # Optional categorization tags
|
||||
meta={"version": "1.1", "author": "data-team"} # Custom metadata
|
||||
)
|
||||
def data_analysis_prompt(
|
||||
data_uri: str = Field(description="The URI of the resource containing the data."),
|
||||
|
|
@ -91,6 +92,12 @@ def data_analysis_prompt(
|
|||
<ParamField body="enabled" type="bool" default="True">
|
||||
A boolean to enable or disable the prompt. See [Disabling Prompts](#disabling-prompts) for more information
|
||||
</ParamField>
|
||||
|
||||
<ParamField body="meta" type="dict[str, Any] | None">
|
||||
<VersionBadge version="2.11.0" />
|
||||
|
||||
Optional meta information about the prompt. This data is passed through to the MCP client as the `_meta` field of the client-side prompt object and can be used for custom metadata, versioning, or other application-specific purposes.
|
||||
</ParamField>
|
||||
</Card>
|
||||
|
||||
### Argument Types
|
||||
|
|
|
|||
|
|
@ -73,7 +73,8 @@ mcp = FastMCP(name="DataServer")
|
|||
name="ApplicationStatus", # Custom name
|
||||
description="Provides the current status of the application.", # Custom description
|
||||
mime_type="application/json", # Explicit MIME type
|
||||
tags={"monitoring", "status"} # Categorization tags
|
||||
tags={"monitoring", "status"}, # Categorization tags
|
||||
meta={"version": "2.1", "team": "infrastructure"} # Custom metadata
|
||||
)
|
||||
def get_application_status() -> dict:
|
||||
"""Internal function description (ignored if description is provided above)."""
|
||||
|
|
@ -116,6 +117,12 @@ def get_application_status() -> dict:
|
|||
</ParamField>
|
||||
</Expandable>
|
||||
</ParamField>
|
||||
|
||||
<ParamField body="meta" type="dict[str, Any] | None">
|
||||
<VersionBadge version="2.11.0" />
|
||||
|
||||
Optional meta information about the resource. This data is passed through to the MCP client as the `_meta` field of the client-side resource object and can be used for custom metadata, versioning, or other application-specific purposes.
|
||||
</ParamField>
|
||||
</Card>
|
||||
|
||||
### Return Values
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ While FastMCP infers the name and description from your function, you can overri
|
|||
name="find_products", # Custom tool name for the LLM
|
||||
description="Search the product catalog with optional category filtering.", # Custom description
|
||||
tags={"catalog", "search"}, # Optional tags for organization/filtering
|
||||
meta={"version": "1.2", "author": "product-team"} # Custom metadata
|
||||
)
|
||||
def search_products_implementation(query: str, category: str | None = None) -> list[dict]:
|
||||
"""Internal function description (ignored if description is provided above)."""
|
||||
|
|
@ -107,6 +108,12 @@ def search_products_implementation(query: str, category: str | None = None) -> l
|
|||
</ParamField>
|
||||
</Expandable>
|
||||
</ParamField>
|
||||
|
||||
<ParamField body="meta" type="dict[str, Any] | None">
|
||||
<VersionBadge version="2.11.0" />
|
||||
|
||||
Optional meta information about the tool. This data is passed through to the MCP client as the `_meta` field of the client-side tool object and can be used for custom metadata, versioning, or other application-specific purposes.
|
||||
</ParamField>
|
||||
</Card>
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue