Skip to main content
Glama

vonmises_random

Generate random numbers from the von Mises distribution for circular data analysis by specifying the mean angle in radians.

Instructions

Generate a random number from the von Mises distribution. This is an example of a tool that uses elicitation to obtain the required parameter kappa (κ).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
muYesThe mean angle mu (μ), expressed in radians between 0 and 2π

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler function for the 'vonmises_random' tool. It takes mu as input, elicits kappa from the user, validates it, and returns a random sample from the von Mises distribution using Python's random.vonmisesvariate.
    async def vonmises_random(
        self,
        ctx: Context,
        mu: Annotated[
            float,
            Field(
                description="The mean angle mu (μ), expressed in radians between 0 and 2π",
                ge=0,
                le=2 * math.pi,
            ),
        ],
    ) -> float:
        """Generate a random number from the von Mises distribution. This is an example of a tool that uses elicitation to obtain the required parameter kappa (κ)."""
        await ctx.info("Requesting the user for the value of kappa for von Mises distribution.")
        response = await ctx.elicit(
            message="Please provide the value of kappa (κ) for the von Mises distribution. It should be a positive number.",
            response_type=float,
        )
        kappa: float = 1.0  # Default value
        match response:  # pragma: no cover
            case AcceptedElicitation(data=kappa):  # type: ignore[misc]
                await ctx.warning(f"Received kappa: {kappa}")
                if kappa < 0:
                    raise McpError(
                        error=ErrorData(
                            code=INVALID_PARAMS,
                            message="kappa (κ) must be a positive number.",
                        )
                    )
            case DeclinedElicitation():  # type: ignore[misc]
                await ctx.warning("User declined to provide kappa (κ). Using default value of 1.0.")
            case CancelledElicitation():  # type: ignore[misc]
                await ctx.warning("User cancelled the operation. The random number will NOT be generated.")
                raise McpError(
                    error=ErrorData(
                        code=INVALID_PARAMS,
                        message="Operation cancelled by the user.",
                    )
                )
        return random.vonmisesvariate(mu, kappa)
  • Pydantic-based input schema definition for the 'mu' parameter, including description and range constraints (0 to 2π). Kappa is elicited at runtime.
        mu: Annotated[
            float,
            Field(
                description="The mean angle mu (μ), expressed in radians between 0 and 2π",
                ge=0,
                le=2 * math.pi,
            ),
        ],
    ) -> float:
  • Tool registration entry in the PyMCP class 'tools' list, specifying the function name and tags.
    {"fn": "vonmises_random", "tags": ["experimental", "elicitation", "example"]},
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It adds some context by mentioning elicitation for the kappa parameter, which isn't in the input schema, but it doesn't cover key behavioral traits like whether the tool is deterministic, what the output format is, or any rate limits. The description is vague on operational details, making it adequate but with clear gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences and front-loaded with the main purpose, but the second sentence about elicitation adds some value without being wasteful. However, it could be more structured or concise by integrating the elicitation note more clearly. It's not overly verbose, but it lacks polish in conveying information efficiently.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (statistical distribution generation), no annotations, and an output schema present, the description is moderately complete. It covers the basic purpose and hints at parameter handling, but it doesn't fully explain the distribution's use cases, output details, or behavioral aspects. The output schema likely handles return values, but the description should do more to compensate for the lack of annotations.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with 'mu' fully documented, so the baseline is 3. The description adds minimal value beyond the schema by mentioning 'kappa (κ)' as a required parameter obtained via elicitation, but this isn't in the schema, creating confusion rather than clarifying semantics. It doesn't enhance understanding of the documented 'mu' parameter.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Generate a random number from the von Mises distribution.' It specifies the verb ('Generate') and resource ('random number from the von Mises distribution'), making it easy to understand what the tool does. However, it doesn't explicitly differentiate from sibling tools (like 'generate_password' or 'permutations'), which are unrelated, so it doesn't fully earn a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides minimal guidance: it mentions that the tool 'uses elicitation to obtain the required parameter kappa (κ),' which hints at how to use it but doesn't specify when to use this tool versus alternatives. There's no explicit context on when or why to choose this distribution over others, or any prerequisites, leaving gaps in usage direction.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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