pirate_summary
Summarize text in pirate style using LLM sampling to transform content into nautical-themed summaries.
Instructions
Summarise the given text in a pirate style. This is an example of a tool that can use LLM sampling to generate a summary.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes |
Implementation Reference
- src/pymcp/server.py:253-262 (handler)The pirate_summary tool handler function. It takes input text and uses the context's LLM sampling (ctx.sample) to generate a concise pirate-style summary with high creativity (temperature=0.9).async def pirate_summary(self, ctx: Context, text: str) -> str | None: """Summarise the given text in a pirate style. This is an example of a tool that can use LLM sampling to generate a summary.""" await ctx.info("Summarising text in pirate style using client LLM sampling.") response = await ctx.sample( messages=text, system_prompt="Your task is to summarise a given text in a pirate style. Use a fun and engaging tone but be concise.", temperature=0.9, # High creativity max_tokens=1024, # Pirates can be a bit verbose! ) return getattr(response, "text", None) # type: ignore
- src/pymcp/server.py:51-73 (registration)Registration of tools in PyMCP class, including the pirate_summary tool with tags indicating it's an example using LLM sampling.tools = [ { "fn": "greet", "tags": ["greeting", "example"], "annotations": {"readOnlyHint": True}, }, { "fn": "generate_password", "tags": ["password-generation", "example"], "annotations": {"readOnlyHint": True}, }, { "fn": "text_web_search", "tags": ["meta-search", "text-search", "searchexample"], }, { "fn": "permutations", "tags": ["math", "permutation", "example"], "annotations": {"readOnlyHint": True}, }, {"fn": "pirate_summary", "tags": ["pirate-summary", "llm-sampling", "example"]}, {"fn": "vonmises_random", "tags": ["experimental", "elicitation", "example"]}, ]