Skip to main content
Glama

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
NameRequiredDescriptionDefault
textYes

Implementation Reference

  • 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
  • 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"]},
    ]

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/anirbanbasu/pymcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server