Skip to main content
Glama
loda-lang

LODA API MCP Server

Official
by loda-lang

get_sequence

Retrieve details about mathematical integer sequences from OEIS by providing their ID, such as A000045 for the Fibonacci sequence.

Instructions

Get details about an integer sequence by ID (e.g. A000045)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesSequence ID (e.g. A000045)

Implementation Reference

  • The primary handler function for the 'get_sequence' tool. It validates the sequence ID format, fetches the sequence details using the API client, formats a text response with key information (name, terms, keywords, authors, OEIS ref), and returns it in the MCP content format.
    private async handleGetSequence(args: { id: string }) { const { id } = args; if (!/^A\d{6,}$/.test(id)) { throw new McpError(ErrorCode.InvalidParams, "id must be a string like A000045"); } const seq = await this.apiClient.getSequence(id); return { content: [ { type: "text", text: `Sequence ${seq.id}: ${seq.name}\n` + `First terms: ${seq.terms.slice(0, 20).join(', ')}${seq.terms.length > 20 ? '...' : ''}\n` + (seq.keywords ? `Keywords: ${seq.keywords.join(', ')}\n` : '') + (Array.isArray((seq as any).authors) && (seq as any).authors.length ? `Authors: ${(seq as any).authors.join(', ')}\n` : '') + (seq.oeisRef ? `OEIS: ${seq.oeisRef}\n` : '') } ] }; }
  • The input schema definition for the 'get_sequence' tool, specifying that it requires a string 'id' parameter (e.g., A000045).
    inputSchema: { type: "object", properties: { id: { type: "string", description: "ID of the integer sequence (e.g. A000045)" } }, required: ["id"], additionalProperties: false }
  • src/index.ts:340-351 (registration)
    The tool registration in the listTools response, defining name, description, and inputSchema for 'get_sequence'.
    { name: "get_sequence", description: "Retrieve detailed information about an integer sequence, including its terms, references, links, and keywords. The ID must match the sequence (e.g. A000045).", inputSchema: { type: "object", properties: { id: { type: "string", description: "ID of the integer sequence (e.g. A000045)" } }, required: ["id"], additionalProperties: false } },
  • Helper method in LODAApiClient that fetches sequence details from the LODA API endpoint `/sequences/{id}`.
    async getSequence(id: string): Promise<SequenceDetails> { return this.makeRequest(`/sequences/${id}`); }
  • TypeScript interface defining the structure of SequenceDetails returned by the API.
    interface SequenceDetails { id: string; name: string; terms: string[]; keywords?: string[]; oeisRef?: string | null; }

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/loda-lang/loda-mcp'

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