get_instruction
Retrieve complete instruction files from the OpenClaw registry to access agent prompts, skills, workflows, and domain packs for deployment.
Instructions
Fetch a complete instruction file from the OpenClaw registry by slug. Returns the full Markdown file including YAML frontmatter, purpose, usage notes, and the deployable instruction text. The instruction is in the "## The Instruction" section.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| slug | Yes | The slug of the instruction file (e.g. "tier1-customer-support", "structured-web-research"). Get slugs from search_registry. | |
| instruction_only | No | If true, return only the deployable instruction text (extracted from the fenced code block). If false, return the full Markdown file. Default: false. |
Implementation Reference
- index.js:167-194 (handler)The handleGetInstruction function implements the tool logic - fetches an instruction file by slug and optionally extracts just the deployable instruction text
async function handleGetInstruction({ slug, instruction_only }) { const markdown = await fetchFile(slug); if (instruction_only) { const instruction = extractInstruction(markdown); if (!instruction) { return { content: [{ type: 'text', text: `Could not extract instruction from ${slug}. Returning full file instead:\n\n${markdown}` }] }; } return { content: [{ type: 'text', text: `# Instruction: ${slug}\n\n\`\`\`\n${instruction}\n\`\`\`\n\nFetched from: ${BASE_URL}/registry/${slug}.md` }] }; } return { content: [{ type: 'text', text: markdown }] }; } - index.js:83-100 (schema)Tool schema definition including name, description, and inputSchema with slug (required) and instruction_only (optional) parameters
{ name: 'get_instruction', description: 'Fetch a complete instruction file from the OpenClaw registry by slug. Returns the full Markdown file including YAML frontmatter, purpose, usage notes, and the deployable instruction text. The instruction is in the "## The Instruction" section.', inputSchema: { type: 'object', properties: { slug: { type: 'string', description: 'The slug of the instruction file (e.g. "tier1-customer-support", "structured-web-research"). Get slugs from search_registry.' }, instruction_only: { type: 'boolean', description: 'If true, return only the deployable instruction text (extracted from the fenced code block). If false, return the full Markdown file. Default: false.' } }, required: ['slug'] } }, - index.js:35-40 (helper)fetchFile helper function that retrieves the markdown file from the registry by slug
async function fetchFile(slug) { const url = `${BASE_URL}/registry/${slug}.md`; const res = await fetch(url); if (!res.ok) throw new Error(`File not found: ${slug} (${res.status})`); return res.text(); } - index.js:42-50 (helper)extractInstruction helper function that parses markdown to extract just the instruction code block from the '## The Instruction' section
function extractInstruction(markdown) { // Pull out just the fenced code block under ## The Instruction const match = markdown.match(/## The Instruction\s*\n[\s\S]*?```[\w]*\n([\s\S]*?)```/); if (match) return match[1].trim(); // Fallback: return everything after ## The Instruction const headerMatch = markdown.split(/## The Instruction/); if (headerMatch.length > 1) return headerMatch[1].trim(); return null; } - index.js:259-261 (registration)Tool routing in the CallToolRequestSchema handler - maps 'get_instruction' tool name to the handleGetInstruction function
switch (name) { case 'search_registry': return await handleSearchRegistry(args || {}); case 'get_instruction': return await handleGetInstruction(args || {});