Skip to main content
Glama

get_fibonacci_sequence

Generate the Fibonacci sequence up to a specified number. Use this tool to calculate mathematical sequences for analysis, programming, or educational purposes.

Instructions

Gets the Fibonacci sequence up to the nth number.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler function for the 'get_fibonacci_sequence' tool, including its schema (Annotated parameter and docstring), registration via @mcp.tool(), and recursive implementation to generate the Fibonacci sequence up to n terms.
    @mcp.tool()
    @handle_errors
    def get_fibonacci_sequence(
        n: Annotated[int, "The length of the Fibonacci sequence to get"]
    ) -> str:
        """Gets the Fibonacci sequence up to the nth number."""
        def build_sequence(count):
            if count <= 0:
                return []
            elif count == 1:
                return [0]
            elif count == 2:
                return [0, 1]
            else:
                prev_sequence = build_sequence(count - 1)
                next_value = prev_sequence[-1] + prev_sequence[-2]
                return prev_sequence + [next_value]
        
        return str(build_sequence(n))
  • my_mcp/server.py:41-41 (registration)
    Registration of the tool using the FastMCP @mcp.tool() decorator.
    @mcp.tool()
  • Helper decorator applied to the tool handler for error handling.
    def handle_errors(func: Callable) -> Callable:
        @functools.wraps(func)
        def wrapper(*args, **kwargs):
            try:
                return func(*args, **kwargs)
            except Exception as e:
                raise ToolError(f"Error in {func.__name__}: {e}")
        return wrapper
Behavior2/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 mentions 'Gets' but doesn't clarify if this is a read-only operation, how it handles invalid inputs (e.g., negative n), performance characteristics, or error conditions. This leaves significant gaps in understanding the tool's behavior.

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

Conciseness5/5

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

The description is extremely concise—a single sentence that directly states the tool's purpose without any fluff. It's front-loaded and wastes no words, making it easy to parse quickly.

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 low complexity (one parameter, no siblings, output schema exists), the description is minimally complete. It covers the basic purpose but lacks behavioral details and usage guidelines. The presence of an output schema means return values don't need explanation, but other aspects like error handling are missing.

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 description adds minimal semantics beyond the input schema, which has 0% description coverage. It clarifies that 'n' represents the 'nth number' in the sequence, providing basic context, but doesn't explain constraints (e.g., n must be positive) or format details. With one parameter and low schema coverage, this is adequate but not comprehensive.

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 with a specific verb ('Gets') and resource ('Fibonacci sequence up to the nth number'), making it immediately understandable. It doesn't need to differentiate from siblings since none exist, but it could be slightly more specific about what 'gets' entails (e.g., generates vs. retrieves).

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 no guidance on when to use this tool versus alternatives, prerequisites, or constraints. It simply states what it does without context, leaving the agent to infer usage scenarios independently.

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/vaheandonians/my-mcp'

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