helm-chart-values
Retrieve the values.yaml file for a specific Helm chart from Artifact Hub by specifying the chart repository, chart name, and optional version.
Instructions
Get the values.yaml file for a specific Helm chart from Artifact Hub
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chartName | Yes | The Helm chart name | |
| chartRepo | Yes | The Helm chart repository name | |
| version | No | The chart version (optional, defaults to latest) |
Implementation Reference
- src/tools/values.ts:19-52 (handler)The handler function that implements the core logic of the 'helm-chart-values' tool. It fetches chart information, determines the version, retrieves the values.yaml content from Artifact Hub, and returns it as text content or an error message.async ({ chartRepo, chartName, version }: ValuesParams) => { try { let packageId: string; let chartVersion: string; // First get the chart info const chartInfo = await getChartInfo(chartRepo, chartName); packageId = chartInfo.package_id; // If version is not provided, use the latest version chartVersion = version || chartInfo.version; // Get the values.yaml const valuesYaml = await getChartValues(packageId, chartVersion); return { content: [ { type: "text", text: valuesYaml, }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error retrieving values.yaml: ${(error as Error).message}`, }, ], }; } }
- src/tools/values.ts:11-18 (schema)Zod schema defining the input parameters for the tool: chartRepo (required string), chartName (required string), version (optional string).{ chartRepo: z.string().describe("The Helm chart repository name"), chartName: z.string().describe("The Helm chart name"), version: z .string() .optional() .describe("The chart version (optional, defaults to latest)"), },
- src/tools/values.ts:7-54 (registration)The registration function for the 'helm-chart-values' tool, called by the main server setup to register the tool with name, description, schema, and handler.export function registerValuesTool(server: McpServer) { return server.tool( "helm-chart-values", "Get the values.yaml file for a specific Helm chart from Artifact Hub", { chartRepo: z.string().describe("The Helm chart repository name"), chartName: z.string().describe("The Helm chart name"), version: z .string() .optional() .describe("The chart version (optional, defaults to latest)"), }, async ({ chartRepo, chartName, version }: ValuesParams) => { try { let packageId: string; let chartVersion: string; // First get the chart info const chartInfo = await getChartInfo(chartRepo, chartName); packageId = chartInfo.package_id; // If version is not provided, use the latest version chartVersion = version || chartInfo.version; // Get the values.yaml const valuesYaml = await getChartValues(packageId, chartVersion); return { content: [ { type: "text", text: valuesYaml, }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error retrieving values.yaml: ${(error as Error).message}`, }, ], }; } } ); }
- src/services/artifactHub.ts:48-55 (helper)Helper function that fetches the values.yaml content from the Artifact Hub API given a package ID and version.// Get chart values.yaml from Artifact Hub export async function getChartValues( packageId: string, version: string ): Promise<string> { const valuesUrl = `https://artifacthub.io/api/v1/packages/${packageId}/${version}/values`; return await fetchFromArtifactHub(valuesUrl, true); }
- src/services/artifactHub.ts:38-46 (helper)Helper function that retrieves chart information (including package_id and version) from Artifact Hub given repo and name.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/index.ts:17-21 (registration)Main server initialization where registerValuesTool is called to register all tools including 'helm-chart-values'.registerInfoTool(server); registerValuesTool(server); registerFuzzySearchValuesTool(server); registerTemplateTool(server); registerFuzzySearchTemplatesTool(server);