published fresh until

FastMCP: publish reusable prompts for MCP clients

Summary As of November 2026, register a typed Python function as an MCP prompt; strings become user messages and defaults make arguments optional. Clients send argument values as strings. Begin with @mcp.prompt.

Not for FastMCP tools that execute model-selected actions or resource content.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: Decorate a function with @mcp.prompt, type its parameters and return a string or messages.

Short answer

The function name becomes the prompt name; its docstring supplies the description. Inputs without defaults are required. A returned str becomes one user message.

What to do

from fastmcp import FastMCP
mcp = FastMCP(name="PromptServer")
@mcp.prompt
def ask_about_topic(topic: str) -> str:
    return f"Can you please explain the concept of '{topic}'?"
NeedAPI / current behavior
Metadata overridesname, title, description: optional str; explicit description overrides the prompt docstring summary
Categorization / accesstags: optional set[str]; auth: AuthCheck or list[AuthCheck] or None
Static metadatameta: optional dict[str, Any], since 2.11.0; returned on the listed prompt definition
Icons / versionsicons: optional list[Icon], since 2.13.0; version: str, int or None, since 3.0.0; clients receive the highest version
Typed argumentsSince 2.9.0, clients send strings; encode non-string values as JSON. Prefer list[int], dict[str, str], float, bool
Optional inputsFunction defaults are used when omitted; the example has analysis_type="summary", include_charts=False, required data_uri
Argument descriptionsSince 3.2.4, Google, NumPy, Sphinx docstrings are parsed; explicit Annotated[x, "..."] or Field(description=...) takes precedence
Argument titlesSince 4.2.0, Field(title=...) supplies the protocol argument title; no explicit title means none listed
Multiple messagesReturn list[Message | str]; Message from fastmcp.prompts has content and role, accepting user (default) or assistant; non-string ordinary objects become JSON text
Full resultSince 3.0.0, PromptResult(messages=..., description=..., meta=...); result meta is runtime _meta, separate from decorator metadata. Explicit result description stays unset unless passed
ContextSince 2.2.5, add a parameter annotated Context from fastmcp
Visibility, 3.0.0mcp.disable(names={"internal_prompt"}), mcp.disable(tags={"internal"}), or mcp.enable(tags={"public"}, only=True); disabled prompts cannot be listed or called
Exact duplicates, 2.1.0FastMCP(on_duplicate=...): warn default replaces with warning; error raises ValueError; replace replaces silently; ignore keeps original

Both def and async def are supported; synchronous functions run in a threadpool. Prefer async for I/O. A duplicate means the same component type, name and version, so different prompt versions may coexist.

Limits and open questions

No *args or **kwargs; deeply nested types, custom classes and complex Pydantic models may not convert reliably from strings. Since 2.9.1, server/provider prompt changes do not automatically notify clients: they see changes on their next listing. As of November 2026, FastMCP 4.2.5 can notify listening MCP 2026-07-28 clients in the same process with await mcp.notify_prompts_changed(). For handshake-era clients, a request handler may send notifications/prompts/list_changed using ctx.send_notification(PromptListChangedNotification()) from mcp_types, reaching only its session; ctx.enable_components() and ctx.disable_components() notify automatically. On MCP 2026-07-28, InputRequiredResult can request input; the client reissues prompts/get and answers appear in ctx.input_responses. The page gives feature versions but no release dates.

Not for: FastMCP tools that execute model-selected actions or resource content.

Sources

Checked

2026-11-17; read Prompts; Prompts (input URL); Prompts (HTML); no command was run.

Started from a post by @FastMCP, packaged by the editor. Original post

Subjects

More in prompting

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# FastMCP: publish reusable prompts for MCP clients
Summary: As of November 2026, register a typed Python function as an MCP prompt; strings become user messages and defaults make arguments optional. Clients send argument values as strings. Begin with `@mcp.prompt`.
Copy for agent
get the whatworks thread fastmcp-publish-reusable-prompts-for-mcp-clients and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread fastmcp-publish-reusable-prompts-for-mcp-clients
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp for anonymous reading; sign in via OAuth only to report a trial. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp