Skip to main content
Glama
loda-lang

LODA API MCP Server

Official
by loda-lang

search_programs

Search LODA assembly programs by keywords, ID, or name to explore mathematical integer sequences from OEIS.

Instructions

Search for LODA programs by keywords, ID, or name.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMax results
qYesSearch query
skipNoOffset for pagination

Implementation Reference

  • The main handler function for the 'search_programs' tool. Validates input parameters, calls the LODA API client to perform the search, formats the results into MCP-compatible content (text summary and raw data), and returns the response.
    private async handleSearchPrograms(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.searchPrograms(q, limit, skip, shuffle);
      return {
        content: [
          {
            type: "text",
            text: result.results.length === 0 ?
              'No programs 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
      };
    }
  • Tool definition including name, detailed description, and input schema (JSON Schema) for validation of parameters: q (required string), optional limit, skip, shuffle.
    {
      name: "search_programs",
      description:
        "Search for LODA programs using flexible criteria. Supports pagination.\n" +
        "\nSupported search criteria:\n" +
        "- Name: Matches tokens in the program name (case-insensitive).\n" +
        "- ID: Matches tokens in the program 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) to match in the LODA program (e.g., `mov add`). Exclude operation types by prefixing with a minus sign (e.g., `-mul`).\n" +
        "- Submitter: Matches tokens in the submitter's name (case-insensitive).\n" +
        "- Advanced: All tokens in the query must be present in either the program name or submitter name. Keywords and operation types are handled as described above.\n" +
        "\nExample queries:\n" +
        "- 'Fibonacci core' (programs with 'Fibonacci' in the name and the 'core' keyword)\n" +
        "- 'A000045' (program with ID A000045)" +
        "- 'Alice' (programs submitted by Alice)\n" +
        "- '-hard' (exclude programs with the 'hard' keyword)\n" +
        "- 'bin' (include programs with 'bin' operations)\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
      }
    },
  • src/index.ts:413-414 (registration)
    Registration of the 'search_programs' tool in the CallToolRequestSchema switch dispatcher, mapping the tool name to its handler function.
    case "search_programs":
      return this.handleSearchPrograms(safeArgs as { q: string; limit?: number; skip?: number; shuffle?: boolean });
  • API client helper method that constructs the search query parameters and makes the HTTP request to the LODA API endpoint /programs/search for fetching program search results.
    async searchPrograms(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(`/programs/search?${params.toString()}`);
    }
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 mentions search functionality but doesn't describe important behaviors like pagination handling (implied by skip/limit parameters), result format, error conditions, or rate limits. The description is minimal and lacks operational context.

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. There's zero wasted language or redundancy, making it efficiently front-loaded with the essential information.

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 insufficient. It doesn't explain what constitutes a 'LODA program', what fields are searchable, result format, pagination behavior, or how the search actually works. The minimal description leaves too many operational questions unanswered.

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 the schema already documents all three parameters thoroughly. The description mentions search criteria (keywords, ID, or name) which aligns with the 'q' parameter, but adds no additional semantic context beyond what's in the schema descriptions.

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 LODA programs using specific criteria (keywords, ID, or name). It uses a specific verb ('search') and identifies the resource ('LODA programs'), but doesn't explicitly differentiate from sibling tools like 'search_sequences' or 'get_program'.

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_program' (for specific IDs) or 'search_sequences'. There's no mention of prerequisites, typical use cases, or when other tools might be more appropriate.

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