Skip to main content
Glama
6

MCP Server RubyGems

by 6

get_owner_gems

Retrieve all RubyGems owned by a specific user or organization using the RubyGems API. Input the owner’s username to fetch a detailed list of associated gems.

Instructions

Get all RubyGems owned by a specific user or organization

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
$schemaNo
additionalPropertiesNo
propertiesNo
requiredNo
typeNo

Implementation Reference

  • The MCP tool handler for 'get_owner_gems', which parses input arguments, fetches the gems using getOwnerGems, and returns the JSON-formatted result or an error response.
    handler: async (args: Record<string, unknown> | undefined) => {
      const { owner_name } = GetOwnerGemsInputSchema.parse(args || {});
    
      try {
        const ownerGems = await getOwnerGems(owner_name);
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(ownerGems, null, 2),
            },
          ],
        };
      } catch (error: unknown) {
        return createErrorResponse(error, 'Failed to fetch gems for owner');
      }
    },
  • Core implementation that performs the HTTP fetch to RubyGems API for owner's gems and parses/validates the response using OwnerGemSchema.
    async function getOwnerGems(ownerName: string): Promise<OwnerGem[]> {
      const response = await fetch(
        `https://rubygems.org/api/v1/owners/${ownerName}/gems.json`
      );
    
      if (!response.ok) {
        if (response.status === 404) {
          throw new Error(`Owner '${ownerName}' not found`);
        }
        throw new Error(`Failed to fetch gems for owner: ${response.statusText}`);
      }
    
      const data = await response.json();
      return z.array(OwnerGemSchema).parse(data);
    }
  • Input schema for the tool using Zod, defining the required 'owner_name' parameter.
    const GetOwnerGemsInputSchema = z.object({
      owner_name: z
        .string()
        .min(1)
        .describe('Username of the RubyGem owner to fetch gems for'),
    });
  • Output schema defining the structure of each gem returned by the RubyGems API.
    const OwnerGemSchema = z.object({
      name: z.string(),
      downloads: z.number(),
      version: z.string(),
      version_downloads: z.number(),
      platform: z.string(),
      authors: z.string(),
      info: z.string(),
      licenses: z.array(z.string()).nullable(),
      project_uri: z.string(),
      gem_uri: z.string(),
      homepage_uri: z.string().nullable(),
      wiki_uri: z.string().nullable(),
      documentation_uri: z.string().nullable(),
      mailing_list_uri: z.string().nullable(),
      source_code_uri: z.string().nullable(),
      bug_tracker_uri: z.string().nullable(),
      funding_uri: z.string().nullable(),
    });
  • src/index.ts:13-27 (registration)
    Imports the getOwnerGemsTool and includes it in the tools array used by the MCP server for tool listing and calling.
    import { getOwnerGemsTool } from './tools/get_owner_gems.js';
    import { searchRubyGemsTool } from './tools/search_rubygems.js';
    import { type McpTool } from './tools/types.js';
    
    /**
     * Define the array of available tools
     */
    const tools: readonly McpTool[] = [
      getRubyGemInfoTool,
      searchRubyGemsTool,
      getGemVersionsTool,
      getGemReverseDependenciesTool,
      getOwnerGemsTool,
      getGemOwnersTool,
    ] as const;

Tool Definition Quality

Score is being calculated. Check back soon.

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