Skip to main content
Glama
AlexW00

ArtifactHub MCP Server

by AlexW00

helm-chart-template

Retrieve template file content from Helm charts on Artifact Hub by specifying repository, chart name, and exact filename.

Instructions

Get the content of a template file from a Helm chart in Artifact Hub

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chartRepoYesThe Helm chart repository name
chartNameYesThe Helm chart name
filenameYesExact filename (full path) to filter templates by (case-sensitive)
versionNoThe chart version (optional, defaults to latest)

Implementation Reference

  • The handler function that implements the core logic of the 'helm-chart-template' tool: fetches chart info, retrieves and decodes templates from Artifact Hub API, filters by exact filename, formats the output as text content, handles errors.
    	async ({ chartRepo, chartName, filename, version }: TemplatesParams) => {
    		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 templates
    			const templatesResult = await getChartTemplates(
    				packageId,
    				chartVersion
    			);
    
    			// Filter templates by exact filename match
    			const filteredTemplates = templatesResult.templates.filter(
    				(template) => template.name === filename
    			);
    
    			// Format the response
    			const formattedResponse = filteredTemplates
    				.map((template) => {
    					return `--- Template: ${template.name} ---\n${template.content}\n\n`;
    				})
    				.join("");
    
    			return {
    				content: [
    					{
    						type: "text",
    						text:
    							formattedResponse ||
    							"No matching templates found for this chart",
    					},
    				],
    			};
    		} catch (error) {
    			return {
    				content: [
    					{
    						type: "text",
    						text: `Error retrieving templates: ${(error as Error).message}`,
    					},
    				],
    			};
    		}
    	}
    );
  • Zod schema for input validation of the tool parameters: chartRepo, chartName, filename (required exact match), version (optional).
    {
    	chartRepo: z.string().describe("The Helm chart repository name"),
    	chartName: z.string().describe("The Helm chart name"),
    	filename: z
    		.string()
    		.describe(
    			"Exact filename (full path) to filter templates by (case-sensitive)"
    		),
    	version: z
    		.string()
    		.optional()
    		.describe("The chart version (optional, defaults to latest)"),
    },
  • The registration function for the 'helm-chart-template' tool, called from index.ts, which defines the tool name, description, input schema, and handler using server.tool().
    export function registerTemplateTool(server: McpServer) {
    	return server.tool(
    		"helm-chart-template",
    		"Get the content of a template file from a Helm chart in Artifact Hub",
    		{
    			chartRepo: z.string().describe("The Helm chart repository name"),
    			chartName: z.string().describe("The Helm chart name"),
    			filename: z
    				.string()
    				.describe(
    					"Exact filename (full path) to filter templates by (case-sensitive)"
    				),
    			version: z
    				.string()
    				.optional()
    				.describe("The chart version (optional, defaults to latest)"),
    		},
    		async ({ chartRepo, chartName, filename, version }: TemplatesParams) => {
    			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 templates
    				const templatesResult = await getChartTemplates(
    					packageId,
    					chartVersion
    				);
    
    				// Filter templates by exact filename match
    				const filteredTemplates = templatesResult.templates.filter(
    					(template) => template.name === filename
    				);
    
    				// Format the response
    				const formattedResponse = filteredTemplates
    					.map((template) => {
    						return `--- Template: ${template.name} ---\n${template.content}\n\n`;
    					})
    					.join("");
    
    				return {
    					content: [
    						{
    							type: "text",
    							text:
    								formattedResponse ||
    								"No matching templates found for this chart",
    						},
    					],
    				};
    			} catch (error) {
    				return {
    					content: [
    						{
    							type: "text",
    							text: `Error retrieving templates: ${(error as Error).message}`,
    						},
    					],
    				};
    			}
    		}
    	);
    }
  • Helper function to fetch basic chart information (package_id, version) from Artifact Hub API, used by the tool handler.
    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;
    }
  • Helper function to fetch chart templates from Artifact Hub API, decode base64 content to UTF-8, used by the tool handler.
    export async function getChartTemplates(
    	packageId: string,
    	version: string
    ): Promise<{ templates: DecodedChartTemplate[] }> {
    	const templatesUrl = `https://artifacthub.io/api/v1/packages/${packageId}/${version}/templates`;
    	const response = (await fetchFromArtifactHub(
    		templatesUrl
    	)) as ChartTemplatesResponse;
    
    	// Decode base64 data for each template
    	return {
    		templates: response.templates.map((template) => ({
    			name: template.name,
    			content: Buffer.from(template.data, "base64").toString("utf-8"),
    		})),
    	};
    }
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 tool retrieves content but doesn't mention whether it's a read-only operation, potential rate limits, authentication needs, or error handling. This leaves significant behavioral gaps for a tool interacting with an external service like Artifact Hub.

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, clear sentence that directly states the tool's purpose without unnecessary words. It's front-loaded and efficiently conveys the core functionality, making it easy for an agent 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 of interacting with Helm charts and Artifact Hub, the description is insufficient. With no annotations, no output schema, and a tool that likely returns file content, it lacks details on response format, error cases, or dependencies. This leaves the agent with incomplete operational context.

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?

The schema description coverage is 100%, so the schema already documents all parameters thoroughly. The description doesn't add any additional meaning or context beyond what's in the schema, such as examples or usage notes. This meets the baseline for high schema coverage.

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 action ('Get the content') and resource ('a template file from a Helm chart in Artifact Hub'), making the purpose understandable. However, it doesn't explicitly differentiate from sibling tools like 'helm-chart-templates-fuzzy-search' (which likely searches rather than retrieves exact content), so it misses full sibling distinction.

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. It doesn't mention sibling tools like 'helm-chart-templates-fuzzy-search' for fuzzy matching or 'helm-chart-info' for general chart metadata, leaving the agent without context for tool selection.

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/AlexW00/artifacthub-mcp'

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