helm-chart-info
Retrieve Helm chart details from Artifact Hub, including version information and descriptions, by specifying repository and chart names.
Instructions
Get information about a Helm chart from Artifact Hub, including ID, latest version, and description
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chartRepo | Yes | The Helm chart repository name | |
| chartName | Yes | The Helm chart name |
Implementation Reference
- src/tools/info.ts:15-44 (handler)Handler function for the helm-chart-info tool, which fetches chart info using getChartInfo and formats the response as text.async ({ chartRepo, chartName }: InfoParams) => { try { const data = await getChartInfo(chartRepo, chartName); return { content: [ { type: "text", text: JSON.stringify( { id: data.package_id, latest_version: data.version, description: data.description, }, null, 2 ), }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error retrieving chart info: ${(error as Error).message}`, }, ], }; }
- src/tools/info.ts:11-14 (schema)Zod schema defining input parameters for the helm-chart-info tool: chartRepo and chartName.{ chartRepo: z.string().describe("The Helm chart repository name"), chartName: z.string().describe("The Helm chart name"), },
- src/tools/info.ts:7-47 (registration)Registration of the helm-chart-info tool with the MCP server, including name, description, schema, and handler.export function registerInfoTool(server: McpServer) { return server.tool( "helm-chart-info", "Get information about a Helm chart from Artifact Hub, including ID, latest version, and description", { chartRepo: z.string().describe("The Helm chart repository name"), chartName: z.string().describe("The Helm chart name"), }, async ({ chartRepo, chartName }: InfoParams) => { try { const data = await getChartInfo(chartRepo, chartName); return { content: [ { type: "text", text: JSON.stringify( { id: data.package_id, latest_version: data.version, description: data.description, }, null, 2 ), }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error retrieving chart info: ${(error as Error).message}`, }, ], }; } } ); }
- src/services/artifactHub.ts:38-46 (helper)Core helper function that fetches the Helm chart information from the Artifact Hub API.export async function getChartInfo( chartRepo: string, chartName: string ): Promise<ArtifactHubPackage> { const url = `https://artifacthub.io/api/v1/packages/helm/${encodeURIComponent( chartRepo )}/${encodeURIComponent(chartName)}`; return (await fetchFromArtifactHub(url)) as ArtifactHubPackage; }
- src/types/artifactHub.ts:14-17 (schema)TypeScript interface defining the input parameters for the helm-chart-info tool.export interface InfoParams { chartRepo: string; chartName: string; }
- src/services/artifactHub.ts:9-35 (helper)Utility function to fetch data from Artifact Hub API, used by getChartInfo.export async function fetchFromArtifactHub( url: string, isYaml: boolean = false ): Promise<any> { try { const response = await fetch(url, { headers: { Accept: isYaml ? "application/yaml" : "application/json", }, }); if (!response.ok) { throw new Error( `API request failed with status ${response.status}: ${response.statusText}` ); } if (isYaml) { return await response.text(); } else { return await response.json(); } } catch (error) { console.error("Error fetching from Artifact Hub:", error); throw error; } }