Skip to main content
Glama
loda-lang

LODA API MCP Server

Official
by loda-lang

search_sequences

Find integer sequences from OEIS by keywords, ID, or name to support mathematical research and algorithm development.

Instructions

Search for integer sequences by keywords, ID, or name.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMax results
qYesSearch query
skipNoOffset for pagination

Implementation Reference

  • MCP tool handler for 'search_sequences'. Validates input, delegates to apiClient.searchSequences, formats results as MCP content block listing sequences with total count.
    private async handleSearchSequences(args: { q: string; limit?: number; skip?: number; shuffle?: boolean }) {
      const { q, limit, skip, shuffle } = args;
      if (!q || typeof q !== 'string') {
        throw new McpError(ErrorCode.InvalidParams, "q is required");
      }
      const result = await this.apiClient.searchSequences(q, limit, skip, shuffle);
      return {
        content: [
          {
            type: "text",
            text: result.results.length === 0 ?
              'No sequences found.' :
              result.results.map((r: {id: string, name: string, keywords?: string[]}) =>
                `${r.id}: ${r.name}` + (r.keywords && r.keywords.length ? ` [${r.keywords.join(', ')}]` : '')
              ).join('\n') +
              `\nTotal: ${result.total}`
          }
        ],
        ...result
      };
    }
  • JSON schema defining the input parameters for the search_sequences tool: required 'q' string, optional limit (1-100), skip (>=0), shuffle (bool).
    inputSchema: {
      type: "object",
      properties: {
        q: { type: "string", description: "Search query supporting keywords, properties, submitters, and advanced criteria. To require a keyword, include it; to exclude, prefix with '-' (e.g., -core)." },
        limit: { type: "number", description: "Maximum number of results to return (pagination limit)", minimum: 1, maximum: 100 },
        skip: { type: "number", description: "Number of items to skip before starting to collect the result set (pagination offset)", minimum: 0 },
        shuffle: { type: "boolean", description: "If set to true, the search results will be shuffled randomly" }
      },
      required: ["q"],
      additionalProperties: false
    }
  • src/index.ts:352-380 (registration)
    Registration of the 'search_sequences' tool in the MCP ListTools handler, including name, detailed description of search capabilities, and input schema.
    {
      name: "search_sequences",
      description:
        "Search for integer sequences using flexible criteria. Supports pagination.\n" +
        "\nSupported search criteria:\n" +
        "- Name: Matches tokens in the sequence name (case-insensitive).\n" +
        "- ID: Matches tokens in the sequence ID (e.g., A000045).\n" +
        "- Keywords: Include keywords by specifying them in the query (e.g., 'core easy'). Exclude keywords by prefixing with a minus sign (e.g., '-hard').\n" +
        "- Operation Types: Include operation types (opcodes) of the corresponding LODA program (e.g., `mov add`). Exclude operation types by prefixing with a minus sign (e.g., `-mul`).\n" +
        "- Author: Matches tokens in the author names (case-insensitive).\n" +
        "- Submitter: Matches tokens in the submitter names of the corresponding LODA programs (case-insensitive).\n" +
        "- Advanced: All tokens in the query must be present in either the sequence name, author name, or submitter name. Keywords are handled as described above.\n" +
        "\nExample queries:\n" +
        "- 'Fibonacci core' (sequences with 'Fibonacci' in the name and the 'core' keyword)\n" +
        "- 'A000045' (sequence with ID A000045)" +
        "- 'Alice' (sequences authored by Alice or with programs submitted by Alice)\n" +
        "- '-hard' (exclude sequences with the 'hard' keyword)\n",
      inputSchema: {
        type: "object",
        properties: {
          q: { type: "string", description: "Search query supporting keywords, properties, submitters, and advanced criteria. To require a keyword, include it; to exclude, prefix with '-' (e.g., -core)." },
          limit: { type: "number", description: "Maximum number of results to return (pagination limit)", minimum: 1, maximum: 100 },
          skip: { type: "number", description: "Number of items to skip before starting to collect the result set (pagination offset)", minimum: 0 },
          shuffle: { type: "boolean", description: "If set to true, the search results will be shuffled randomly" }
        },
        required: ["q"],
        additionalProperties: false
      }
    },
  • API client helper method that builds query parameters for sequence search and invokes the generic makeRequest to fetch from LODA API /sequences/search endpoint.
    async searchSequences(q: string, limit?: number, skip?: number, shuffle?: boolean): Promise<{ total: number; results: { id: string; name: string; keywords?: string[] }[] }> {
      const params = new URLSearchParams({ q });
      if (limit !== undefined) params.append('limit', String(limit));
      if (skip !== undefined) params.append('skip', String(skip));
      if (shuffle !== undefined) params.append('shuffle', String(shuffle));
      // The API returns { total, results: [{id, name, keywords?}] }
      return this.makeRequest(`/sequences/search?${params.toString()}`);
    }
  • src/index.ts:425-426 (registration)
    Dispatcher switch case in CallToolRequest handler that routes 'search_sequences' calls to the handleSearchSequences method.
    case "search_sequences":
      return this.handleSearchSequences(safeArgs as { q: string; limit?: number; skip?: number; shuffle?: boolean });
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It only states what the tool does at a high level, without mentioning pagination behavior (implied by skip/limit parameters), rate limits, authentication requirements, error conditions, or what format the results will be in. For a search tool with 3 parameters, this leaves significant behavioral aspects undocumented.

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 at just one sentence with no wasted words. It's front-loaded with the core purpose and efficiently lists the three search criteria. Every element earns its place in this minimal description.

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

Completeness2/5

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

For a search tool with 3 parameters and no annotations or output schema, the description is insufficiently complete. It doesn't explain what constitutes a valid search query, how results are returned, what fields are included, or any limitations. The agent would need to guess about the tool's behavior and output format based on minimal information.

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?

Schema description coverage is 100%, so all parameters are documented in the schema. The description adds minimal value beyond the schema by mentioning search criteria (keywords, ID, name) which relates to the 'q' parameter, but doesn't provide additional context about how these criteria work together or format expectations. Baseline 3 is appropriate when the schema does the heavy lifting.

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 as searching for integer sequences using specific criteria (keywords, ID, or name). It specifies the verb 'search' and resource 'integer sequences', making the function unambiguous. However, it doesn't differentiate from sibling tools like 'search_programs' or 'get_sequence', which would require more specific scope definition.

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 like 'get_sequence' or 'search_programs'. It mentions search criteria but doesn't indicate whether this is the primary search tool, when to prefer it over direct lookup tools, or any prerequisites for effective use.

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

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