1b74b06753
Cut comment and docstring volume roughly in half across src, tests, examples, and docs_src: removed comments that restate the adjacent code, leftover development narration, section banners, and self-evident Args/Returns blocks, and compressed the remaining docstrings to a Google-style summary line plus only the detail that earns its place. Kept (and tightened) the load-bearing content: Raises sections, deprecation and version-availability notes, spec/RFC/issue references, why-comments for non-obvious decisions, and all coverage pragmas. The generated mcp_types.v* wire modules are untouched.
19 lines
617 B
Python
19 lines
617 B
Python
"""MCPServer Example showing parameter descriptions"""
|
|
|
|
from pydantic import Field
|
|
|
|
from mcp.server.mcpserver import MCPServer
|
|
|
|
mcp = MCPServer("Parameter Descriptions Server")
|
|
|
|
|
|
@mcp.tool()
|
|
def greet_user(
|
|
name: str = Field(description="The name of the person to greet"),
|
|
title: str = Field(description="Optional title like Mr/Ms/Dr", default=""),
|
|
times: int = Field(description="Number of times to repeat the greeting", default=1),
|
|
) -> str:
|
|
"""Greet a user with optional title and repetition"""
|
|
greeting = f"Hello {title + ' ' if title else ''}{name}!"
|
|
return "\n".join([greeting] * times)
|