get_skill
Retrieve complete skill details including documentation, security information, and metadata from the agentskill-mcp server for AI agent skill management.
Instructions
Get full details for a specific skill including its SKILL.md content, security info, and metadata.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| slug | Yes | Skill slug (e.g. 'seo-optimizer', 'react-best-practices') |
Implementation Reference
- src/index.ts:145-214 (registration)Complete registration of the get_skill tool using server.tool() with name, description, input schema, and handler function
// Tool: get_skill server.tool( "get_skill", "Get full details for a specific skill including its SKILL.md content, security info, and metadata.", { slug: z .string() .describe("Skill slug (e.g. 'seo-optimizer', 'react-best-practices')"), }, async ({ slug }) => { const data = await apiFetch<{ data: { name: string; slug: string; description: string; owner: string; repositoryUrl: string; platforms: string[]; installCount: number; score: number; ratingCount: number; skillMd: string; readme: string; tags: string[]; skillTypes: string[]; isVerified: boolean; }; }>(`/skills/${encodeURIComponent(slug)}`); const s = data.data; if (!s) { return { content: [{ type: "text" as const, text: `Skill "${slug}" not found.` }], }; } const rating = s.score ? `${s.score.toFixed(1)}/5 (${s.ratingCount} ratings)` : "No ratings yet"; const sections = [ `# ${s.name}`, "", s.description, "", "## Metadata", `- **Owner**: ${s.owner}`, `- **Repository**: ${s.repositoryUrl || "N/A"}`, `- **Platforms**: ${s.platforms?.join(", ") || "all"}`, `- **Types**: ${s.skillTypes?.join(", ") || "N/A"}`, `- **Tags**: ${s.tags?.join(", ") || "N/A"}`, `- **Installs**: ${s.installCount.toLocaleString()}`, `- **Rating**: ${rating}`, `- **Verified**: ${s.isVerified ? "Yes" : "No"}`, ]; if (s.skillMd) { sections.push("", "## SKILL.md Content", "", s.skillMd); } sections.push( "", `Install: use the install_skill tool with slug "${s.slug}"`, `View on web: https://agentskill.sh/skills/${s.slug}` ); return { content: [{ type: "text" as const, text: sections.join("\n") }], }; } ); - src/index.ts:154-213 (handler)Handler function that fetches skill data from API using slug parameter, formats the response with metadata, SKILL.md content, and returns formatted text output
async ({ slug }) => { const data = await apiFetch<{ data: { name: string; slug: string; description: string; owner: string; repositoryUrl: string; platforms: string[]; installCount: number; score: number; ratingCount: number; skillMd: string; readme: string; tags: string[]; skillTypes: string[]; isVerified: boolean; }; }>(`/skills/${encodeURIComponent(slug)}`); const s = data.data; if (!s) { return { content: [{ type: "text" as const, text: `Skill "${slug}" not found.` }], }; } const rating = s.score ? `${s.score.toFixed(1)}/5 (${s.ratingCount} ratings)` : "No ratings yet"; const sections = [ `# ${s.name}`, "", s.description, "", "## Metadata", `- **Owner**: ${s.owner}`, `- **Repository**: ${s.repositoryUrl || "N/A"}`, `- **Platforms**: ${s.platforms?.join(", ") || "all"}`, `- **Types**: ${s.skillTypes?.join(", ") || "N/A"}`, `- **Tags**: ${s.tags?.join(", ") || "N/A"}`, `- **Installs**: ${s.installCount.toLocaleString()}`, `- **Rating**: ${rating}`, `- **Verified**: ${s.isVerified ? "Yes" : "No"}`, ]; if (s.skillMd) { sections.push("", "## SKILL.md Content", "", s.skillMd); } sections.push( "", `Install: use the install_skill tool with slug "${s.slug}"`, `View on web: https://agentskill.sh/skills/${s.slug}` ); return { content: [{ type: "text" as const, text: sections.join("\n") }], }; } - src/index.ts:149-153 (schema)Input schema definition using zod for the slug parameter with description of expected format (e.g., 'seo-optimizer', 'react-best-practices')
{ slug: z .string() .describe("Skill slug (e.g. 'seo-optimizer', 'react-best-practices')"), }, - src/index.ts:14-27 (helper)apiFetch helper function used by the handler to make authenticated requests to the agentskill.sh API endpoint
async function apiFetch<T>(path: string, options?: RequestInit): Promise<T> { const res = await fetch(`${API_BASE}${path}`, { ...options, headers: { "Content-Type": "application/json", "User-Agent": "agentskill-mcp/0.1.0", ...options?.headers, }, }); if (!res.ok) { throw new Error(`API error: ${res.status} ${res.statusText}`); } return res.json() as Promise<T>; }