Skip to main content
Glama
6

MCP Server RubyGems

by 6

get_gem_versions

Fetch all available versions of a specific RubyGem by providing its name. Specify a limit to control the number of versions returned for efficient analysis.

Instructions

Get all available versions of a specific RubyGem

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
$schemaNo
additionalPropertiesNo
propertiesNo
requiredNo
typeNo

Implementation Reference

  • The handler function for the MCP tool 'get_gem_versions'. It parses the input arguments using the schema, calls the getGemVersions helper, formats the response as text content, or returns an error response.
    handler: async (args: Record<string, unknown> | undefined) => {
      const { gem_name, limit } = GetGemVersionsInputSchema.parse(args || {});
    
      try {
        const versions = await getGemVersions(gem_name, limit);
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(versions, null, 2),
            },
          ],
        };
      } catch (error: unknown) {
        return createErrorResponse(error, 'Failed to fetch gem versions');
      }
    },
  • Zod schema defining the input parameters for the get_gem_versions tool: required 'gem_name' string and optional 'limit' positive integer.
    const GetGemVersionsInputSchema = z.object({
      gem_name: z
        .string()
        .min(1)
        .describe('Name of the RubyGem to fetch versions for'),
      limit: z
        .number()
        .int()
        .positive()
        .optional()
        .describe('Maximum number of versions to return'),
    });
  • Helper function that performs the HTTP fetch to RubyGems API for versions of a gem, handles errors, parses and validates the JSON response using Zod's GemVersionSchema, and slices to limit if specified.
    async function getGemVersions(
      gemName: string,
      limit?: number
    ): Promise<GemVersion[]> {
      const response = await fetch(
        `https://rubygems.org/api/v1/versions/${gemName}.json`
      );
    
      if (!response.ok) {
        if (response.status === 404) {
          throw new Error(`RubyGem '${gemName}' not found`);
        }
        throw new Error(`Failed to fetch versions: ${response.statusText}`);
      }
    
      const data = await response.json();
      let versions = z.array(GemVersionSchema).parse(data);
    
      // Apply limit if provided
      if (limit && limit > 0) {
        versions = versions.slice(0, limit);
      }
    
      return versions;
    }
  • Zod schema for individual RubyGem version objects, used to validate the API response data.
    const GemVersionSchema = z.object({
      number: z.string(),
      created_at: z.string(),
      summary: z.string().nullable(),
      platform: z.string(),
      downloads_count: z.number(),
      prerelease: z.boolean().optional(),
    });
  • src/index.ts:20-27 (registration)
    Registration of the get_gem_versions tool (as getGemVersionsTool) in the MCP server's tools array, which is used for listing tools and dispatching tool calls.
    const tools: readonly McpTool[] = [
      getRubyGemInfoTool,
      searchRubyGemsTool,
      getGemVersionsTool,
      getGemReverseDependenciesTool,
      getOwnerGemsTool,
      getGemOwnersTool,
    ] as const;
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 states the action but does not describe any behavioral traits such as whether it's a read-only operation, potential rate limits, authentication needs, error handling, or response format. This is a significant gap for a tool with no annotation coverage.

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 a single, efficient sentence that directly states the tool's purpose without unnecessary words. It is front-loaded and appropriately sized, making it easy to parse quickly.

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?

Given the complexity (5 parameters, 0% schema coverage, no output schema, and no annotations), the description is incomplete. It does not compensate for the lack of structured data, failing to explain parameters, behavioral aspects, or return values, which are essential for effective tool use.

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

Parameters2/5

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

The schema description coverage is 0%, meaning parameters are undocumented in the schema. The description mentions 'a specific RubyGem', which hints at the 'gem_name' parameter, but it does not cover other parameters (context signals indicate 5 parameters total) or add meaningful details like usage examples or constraints beyond what is implied.

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 verb 'Get' and the resource 'all available versions of a specific RubyGem', making the purpose understandable. However, it does not explicitly differentiate from sibling tools like 'get_rubygem_info' or 'search_rubygems', which might also involve gem version information, so it lacks sibling differentiation.

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 such as 'get_rubygem_info' or 'search_rubygems'. It does not mention any prerequisites, exclusions, or specific contexts for usage, leaving the agent without clear 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

Related 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/6/mcp-server-rubygems'

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