@redpanda-data/docs-extensions-and-macros 4.12.6 → 4.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.adoc +33 -1064
- package/bin/doc-tools-mcp.js +720 -0
- package/bin/doc-tools.js +1050 -50
- package/bin/mcp-tools/antora.js +153 -0
- package/bin/mcp-tools/cache.js +89 -0
- package/bin/mcp-tools/cloud-regions.js +127 -0
- package/bin/mcp-tools/content-review.js +196 -0
- package/bin/mcp-tools/crd-docs.js +153 -0
- package/bin/mcp-tools/frontmatter.js +138 -0
- package/bin/mcp-tools/generated-docs-review.js +887 -0
- package/bin/mcp-tools/helm-docs.js +152 -0
- package/bin/mcp-tools/index.js +245 -0
- package/bin/mcp-tools/job-queue.js +468 -0
- package/bin/mcp-tools/mcp-validation.js +266 -0
- package/bin/mcp-tools/metrics-docs.js +146 -0
- package/bin/mcp-tools/openapi.js +174 -0
- package/bin/mcp-tools/prompt-discovery.js +283 -0
- package/bin/mcp-tools/property-docs.js +157 -0
- package/bin/mcp-tools/rpcn-docs.js +113 -0
- package/bin/mcp-tools/rpk-docs.js +141 -0
- package/bin/mcp-tools/telemetry.js +211 -0
- package/bin/mcp-tools/utils.js +131 -0
- package/bin/mcp-tools/versions.js +168 -0
- package/cli-utils/convert-doc-links.js +1 -1
- package/cli-utils/github-token.js +58 -0
- package/cli-utils/self-managed-docs-branch.js +2 -2
- package/cli-utils/setup-mcp.js +313 -0
- package/docker-compose/25.1/transactions.md +1 -1
- package/docker-compose/transactions.md +1 -1
- package/extensions/DEVELOPMENT.adoc +464 -0
- package/extensions/README.adoc +124 -0
- package/extensions/REFERENCE.adoc +768 -0
- package/extensions/USER_GUIDE.adoc +339 -0
- package/extensions/generate-rp-connect-info.js +3 -4
- package/extensions/version-fetcher/get-latest-console-version.js +38 -27
- package/extensions/version-fetcher/get-latest-redpanda-version.js +65 -54
- package/extensions/version-fetcher/retry-util.js +88 -0
- package/extensions/version-fetcher/set-latest-version.js +6 -3
- package/macros/DEVELOPMENT.adoc +377 -0
- package/macros/README.adoc +105 -0
- package/macros/REFERENCE.adoc +222 -0
- package/macros/USER_GUIDE.adoc +220 -0
- package/macros/rp-connect-components.js +6 -6
- package/mcp/CLI_INTERFACE.adoc +384 -0
- package/mcp/COSTS.adoc +167 -0
- package/mcp/DEVELOPMENT.adoc +726 -0
- package/mcp/README.adoc +172 -0
- package/mcp/USER_GUIDE.adoc +1392 -0
- package/mcp/WRITER_EXTENSION_GUIDE.adoc +814 -0
- package/mcp/prompts/README.adoc +183 -0
- package/mcp/prompts/property-docs-guide.md +283 -0
- package/mcp/prompts/review-for-style.md +128 -0
- package/mcp/prompts/rpcn-connector-docs-guide.md +126 -0
- package/mcp/prompts/write-new-guide.md +222 -0
- package/mcp/team-standards/style-guide.md +321 -0
- package/mcp/templates/README.adoc +212 -0
- package/mcp/templates/prompt-review-template.md +80 -0
- package/mcp/templates/prompt-write-template.md +110 -0
- package/mcp/templates/resource-template.md +76 -0
- package/package.json +16 -5
- package/tools/bundle-openapi.js +20 -10
- package/tools/cloud-regions/generate-cloud-regions.js +1 -1
- package/tools/fetch-from-github.js +18 -4
- package/tools/gen-rpk-ascii.py +3 -1
- package/tools/generate-cli-docs.js +325 -0
- package/tools/get-console-version.js +4 -2
- package/tools/get-redpanda-version.js +4 -2
- package/tools/metrics/metrics.py +19 -7
- package/tools/property-extractor/Makefile +7 -1
- package/tools/property-extractor/cloud_config.py +4 -4
- package/tools/property-extractor/constant_resolver.py +11 -11
- package/tools/property-extractor/property_extractor.py +18 -16
- package/tools/property-extractor/topic_property_extractor.py +2 -2
- package/tools/property-extractor/transformers.py +7 -7
- package/tools/property-extractor/type_definition_extractor.py +4 -4
- package/tools/redpanda-connect/README.adoc +1 -1
- package/tools/redpanda-connect/generate-rpcn-connector-docs.js +5 -3
|
@@ -0,0 +1,814 @@
|
|
|
1
|
+
= How to Extend the MCP Server (For Technical Writers)
|
|
2
|
+
:toc:
|
|
3
|
+
:toc-title: Contents
|
|
4
|
+
|
|
5
|
+
== Overview
|
|
6
|
+
|
|
7
|
+
This guide shows technical writers how to add new prompts, resources, and tools to the doc-tools MCP server. Most extensions require only creating or editing simple files.
|
|
8
|
+
|
|
9
|
+
== What you can add
|
|
10
|
+
|
|
11
|
+
[cols="1,2,1"]
|
|
12
|
+
|===
|
|
13
|
+
|Type |What It Does
|
|
14
|
+
|
|
15
|
+
|Prompts
|
|
16
|
+
|Pre-configured instructions for common tasks (review, write, check, etc.)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|Resources
|
|
20
|
+
|Reference materials (style guides, templates, terminology) that AI can read
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|Tools
|
|
24
|
+
|Custom commands that execute doc-tools operations (programming knowledge required)
|
|
25
|
+
|
|
26
|
+
|===
|
|
27
|
+
|
|
28
|
+
== Adding new prompts
|
|
29
|
+
|
|
30
|
+
=== When to add a new prompt
|
|
31
|
+
|
|
32
|
+
Create a new prompt when you have a repeated task that would benefit from standardized instructions:
|
|
33
|
+
|
|
34
|
+
* Review content for a specific doc type (API reference, tutorial, troubleshooting)
|
|
35
|
+
* Generate content following a specific template
|
|
36
|
+
* Check for specific quality issues
|
|
37
|
+
* Refactor content in a consistent way
|
|
38
|
+
|
|
39
|
+
=== How auto-discovery works
|
|
40
|
+
|
|
41
|
+
The MCP server uses automatic prompt discovery, no code editing required.
|
|
42
|
+
|
|
43
|
+
* Save a `.md` file with YAML frontmatter in `mcp/prompts/`.
|
|
44
|
+
* The server automatically loads it at startup.
|
|
45
|
+
* No need to edit `bin/doc-tools-mcp.js` or any JavaScript files.
|
|
46
|
+
* Just validate, restart Claude Code, and use it!
|
|
47
|
+
|
|
48
|
+
=== Add a new prompt
|
|
49
|
+
|
|
50
|
+
==== Create the prompt file
|
|
51
|
+
|
|
52
|
+
Create a new `.md` file in `mcp/prompts/`:
|
|
53
|
+
|
|
54
|
+
[source,bash]
|
|
55
|
+
----
|
|
56
|
+
cd mcp/prompts
|
|
57
|
+
touch review-api-docs.md
|
|
58
|
+
----
|
|
59
|
+
|
|
60
|
+
==== Add YAML frontmatter
|
|
61
|
+
|
|
62
|
+
At the very top of your file, add metadata using YAML frontmatter:
|
|
63
|
+
|
|
64
|
+
[source,markdown]
|
|
65
|
+
----
|
|
66
|
+
---
|
|
67
|
+
description: "Review API documentation for completeness, clarity, and consistency with team standards"
|
|
68
|
+
version: "1.0.0"
|
|
69
|
+
arguments:
|
|
70
|
+
content:
|
|
71
|
+
description: "The API documentation content to review"
|
|
72
|
+
required: true
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
# Review API Documentation
|
|
76
|
+
|
|
77
|
+
You are reviewing API documentation for the Redpanda documentation team.
|
|
78
|
+
|
|
79
|
+
## Your Task
|
|
80
|
+
|
|
81
|
+
Review API documentation and check for:
|
|
82
|
+
1. [Specific thing to check]
|
|
83
|
+
2. [Another thing to check]
|
|
84
|
+
3. [etc.]
|
|
85
|
+
|
|
86
|
+
## Resources Available
|
|
87
|
+
|
|
88
|
+
Read these resources first:
|
|
89
|
+
- `redpanda://style-guide` - Complete style guide
|
|
90
|
+
- `redpanda://terminology` - Approved terminology
|
|
91
|
+
|
|
92
|
+
## API Documentation Standards
|
|
93
|
+
|
|
94
|
+
[Explain what makes good API docs for your team]
|
|
95
|
+
|
|
96
|
+
### Required Sections
|
|
97
|
+
|
|
98
|
+
All API documentation must include:
|
|
99
|
+
- Overview (what the API does)
|
|
100
|
+
- Authentication requirements
|
|
101
|
+
- Request format (with example)
|
|
102
|
+
- Response format (with example)
|
|
103
|
+
- Error responses
|
|
104
|
+
- Code examples
|
|
105
|
+
|
|
106
|
+
### Format Requirements
|
|
107
|
+
|
|
108
|
+
[Your specific formatting rules]
|
|
109
|
+
|
|
110
|
+
## Output Format
|
|
111
|
+
|
|
112
|
+
Provide feedback in this structure:
|
|
113
|
+
|
|
114
|
+
### Critical Issues
|
|
115
|
+
[Format for issues]
|
|
116
|
+
|
|
117
|
+
### Suggestions
|
|
118
|
+
[Format for suggestions]
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
Please provide the API documentation you'd like me to review.
|
|
123
|
+
----
|
|
124
|
+
|
|
125
|
+
==== Validate your prompt
|
|
126
|
+
|
|
127
|
+
Run the validation command to check for errors:
|
|
128
|
+
|
|
129
|
+
[source,bash]
|
|
130
|
+
----
|
|
131
|
+
doc-tools validate-mcp
|
|
132
|
+
----
|
|
133
|
+
|
|
134
|
+
If validation passes, you're ready to use it!
|
|
135
|
+
|
|
136
|
+
==== Test it
|
|
137
|
+
|
|
138
|
+
Restart Claude Code and test your prompt:
|
|
139
|
+
|
|
140
|
+
[source,text]
|
|
141
|
+
----
|
|
142
|
+
Use the review-api-docs prompt with this content:
|
|
143
|
+
[paste some API docs]
|
|
144
|
+
----
|
|
145
|
+
|
|
146
|
+
=== Prompt template library
|
|
147
|
+
|
|
148
|
+
Copy and customize these templates for common prompt types:
|
|
149
|
+
|
|
150
|
+
==== Review prompt template
|
|
151
|
+
|
|
152
|
+
[source,markdown]
|
|
153
|
+
----
|
|
154
|
+
---
|
|
155
|
+
description: "Review [content type] for [specific aspects]"
|
|
156
|
+
version: "1.0.0"
|
|
157
|
+
arguments:
|
|
158
|
+
content:
|
|
159
|
+
description: "The content to review"
|
|
160
|
+
required: true
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
# [Type] Review Prompt
|
|
164
|
+
|
|
165
|
+
You are reviewing [content type] for the Redpanda documentation team.
|
|
166
|
+
|
|
167
|
+
## Your Task
|
|
168
|
+
|
|
169
|
+
Review the provided content and check for:
|
|
170
|
+
1. [Check 1]
|
|
171
|
+
2. [Check 2]
|
|
172
|
+
3. [Check 3]
|
|
173
|
+
|
|
174
|
+
## Resources
|
|
175
|
+
|
|
176
|
+
- `redpanda://style-guide`
|
|
177
|
+
- `redpanda://terminology`
|
|
178
|
+
|
|
179
|
+
## Standards for [Content Type]
|
|
180
|
+
|
|
181
|
+
[Specific standards]
|
|
182
|
+
|
|
183
|
+
## Output Format
|
|
184
|
+
|
|
185
|
+
### Critical Issues
|
|
186
|
+
[Format]
|
|
187
|
+
|
|
188
|
+
### Suggestions
|
|
189
|
+
[Format]
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
Please provide the content to review.
|
|
194
|
+
----
|
|
195
|
+
|
|
196
|
+
==== Writing prompt template
|
|
197
|
+
|
|
198
|
+
[source,markdown]
|
|
199
|
+
----
|
|
200
|
+
---
|
|
201
|
+
description: "Generate [content type] following team standards"
|
|
202
|
+
version: "1.0.0"
|
|
203
|
+
arguments:
|
|
204
|
+
topic:
|
|
205
|
+
description: "The topic to write about"
|
|
206
|
+
required: true
|
|
207
|
+
context:
|
|
208
|
+
description: "Additional context or requirements"
|
|
209
|
+
required: false
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
# Write [Content Type] Prompt
|
|
213
|
+
|
|
214
|
+
You are writing [content type] for the Redpanda documentation team.
|
|
215
|
+
|
|
216
|
+
## Your Task
|
|
217
|
+
|
|
218
|
+
Create [content type] that follows our standards.
|
|
219
|
+
|
|
220
|
+
## Resources
|
|
221
|
+
|
|
222
|
+
- `redpanda://style-guide`
|
|
223
|
+
- `redpanda://terminology`
|
|
224
|
+
- `redpanda://[content-type]-template` (if you have one)
|
|
225
|
+
|
|
226
|
+
## Standards
|
|
227
|
+
|
|
228
|
+
[Specific standards for this content type]
|
|
229
|
+
|
|
230
|
+
## Structure
|
|
231
|
+
|
|
232
|
+
[Required sections and format]
|
|
233
|
+
|
|
234
|
+
## Quality Checklist
|
|
235
|
+
|
|
236
|
+
- [Requirement 1]
|
|
237
|
+
- [Requirement 2]
|
|
238
|
+
- [Requirement 3]
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
242
|
+
Please provide:
|
|
243
|
+
1. **Topic**: [What to write about]
|
|
244
|
+
2. **[Other context]**: [Additional info needed]
|
|
245
|
+
----
|
|
246
|
+
|
|
247
|
+
== Adding new resources
|
|
248
|
+
|
|
249
|
+
=== When to add a new resource
|
|
250
|
+
|
|
251
|
+
Add a resource when you have reference material that AI should access:
|
|
252
|
+
|
|
253
|
+
* Templates for specific doc types
|
|
254
|
+
* Checklists for quality reviews
|
|
255
|
+
* Reference tables or lists
|
|
256
|
+
* Code style guides
|
|
257
|
+
* Workflow documentation
|
|
258
|
+
|
|
259
|
+
=== How auto-discovery works for resources
|
|
260
|
+
|
|
261
|
+
Resources are automatically discovered too!
|
|
262
|
+
|
|
263
|
+
* Add `.md` or `.json` files to `mcp/team-standards/`
|
|
264
|
+
* The server automatically makes them available
|
|
265
|
+
* No code editing required
|
|
266
|
+
* The filename becomes the resource URI (e.g., `api-template.md` → `redpanda://api-template`)
|
|
267
|
+
|
|
268
|
+
=== Step-by-step: add a new resource
|
|
269
|
+
|
|
270
|
+
Step 1: Create the resource file**
|
|
271
|
+
|
|
272
|
+
Add your file to `mcp/team-standards/`:
|
|
273
|
+
|
|
274
|
+
[source,bash]
|
|
275
|
+
----
|
|
276
|
+
cd mcp/team-standards
|
|
277
|
+
touch api-template.md
|
|
278
|
+
----
|
|
279
|
+
|
|
280
|
+
Step 2: Write the content**
|
|
281
|
+
|
|
282
|
+
Use Markdown or JSON format:
|
|
283
|
+
|
|
284
|
+
[source,markdown]
|
|
285
|
+
----
|
|
286
|
+
# API Documentation Template
|
|
287
|
+
|
|
288
|
+
Use this template when documenting API endpoints.
|
|
289
|
+
|
|
290
|
+
## Structure
|
|
291
|
+
|
|
292
|
+
= API Endpoint Name
|
|
293
|
+
:description: Brief description
|
|
294
|
+
|
|
295
|
+
Overview paragraph explaining what this endpoint does.
|
|
296
|
+
|
|
297
|
+
== Authentication
|
|
298
|
+
|
|
299
|
+
[Authentication requirements]
|
|
300
|
+
|
|
301
|
+
== Request
|
|
302
|
+
|
|
303
|
+
[Request format with example]
|
|
304
|
+
|
|
305
|
+
== Response
|
|
306
|
+
|
|
307
|
+
[Response format with example]
|
|
308
|
+
|
|
309
|
+
== Examples
|
|
310
|
+
|
|
311
|
+
[Code examples]
|
|
312
|
+
|
|
313
|
+
== Error responses
|
|
314
|
+
|
|
315
|
+
[Common errors]
|
|
316
|
+
----
|
|
317
|
+
|
|
318
|
+
Step 3: Validate the resource**
|
|
319
|
+
|
|
320
|
+
Run validation to ensure the file is accessible:
|
|
321
|
+
|
|
322
|
+
[source,bash]
|
|
323
|
+
----
|
|
324
|
+
npx doc-tools validate-mcp
|
|
325
|
+
----
|
|
326
|
+
|
|
327
|
+
Step 4: Reference it in prompts**
|
|
328
|
+
|
|
329
|
+
Update relevant prompts to reference your new resource. The URI is `redpanda://[filename-without-extension]`:
|
|
330
|
+
|
|
331
|
+
[source,markdown]
|
|
332
|
+
----
|
|
333
|
+
## Resources Available
|
|
334
|
+
|
|
335
|
+
- `redpanda://style-guide`
|
|
336
|
+
- `redpanda://terminology`
|
|
337
|
+
- `redpanda://api-template` - Use this template for structure
|
|
338
|
+
----
|
|
339
|
+
|
|
340
|
+
Step 5: Test it**
|
|
341
|
+
|
|
342
|
+
Restart Claude Code and verify:
|
|
343
|
+
|
|
344
|
+
[source,text]
|
|
345
|
+
----
|
|
346
|
+
List available resources
|
|
347
|
+
----
|
|
348
|
+
|
|
349
|
+
Your new resource should appear in the list.
|
|
350
|
+
|
|
351
|
+
=== Resource types and formats
|
|
352
|
+
|
|
353
|
+
==== Markdown resources (.md)
|
|
354
|
+
|
|
355
|
+
Best for:
|
|
356
|
+
- Templates
|
|
357
|
+
- Guidelines
|
|
358
|
+
- Instructions
|
|
359
|
+
- Examples
|
|
360
|
+
|
|
361
|
+
[source,markdown]
|
|
362
|
+
----
|
|
363
|
+
# Resource Title
|
|
364
|
+
|
|
365
|
+
## Section
|
|
366
|
+
|
|
367
|
+
Content here with examples.
|
|
368
|
+
|
|
369
|
+
## Another Section
|
|
370
|
+
|
|
371
|
+
More content.
|
|
372
|
+
----
|
|
373
|
+
|
|
374
|
+
==== JSON resources (.json)
|
|
375
|
+
|
|
376
|
+
Best for:
|
|
377
|
+
- Structured data
|
|
378
|
+
- Terminology lists
|
|
379
|
+
- Configuration examples
|
|
380
|
+
- Reference tables
|
|
381
|
+
|
|
382
|
+
[source,json]
|
|
383
|
+
----
|
|
384
|
+
{
|
|
385
|
+
"category": {
|
|
386
|
+
"item1": {
|
|
387
|
+
"description": "Description here",
|
|
388
|
+
"example": "Example here"
|
|
389
|
+
},
|
|
390
|
+
"item2": {
|
|
391
|
+
"description": "Description here",
|
|
392
|
+
"example": "Example here"
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
----
|
|
397
|
+
|
|
398
|
+
== Updating existing resources
|
|
399
|
+
|
|
400
|
+
=== Update style guide
|
|
401
|
+
|
|
402
|
+
Edit `mcp/team-standards/style-guide.md`:
|
|
403
|
+
|
|
404
|
+
[source,bash]
|
|
405
|
+
----
|
|
406
|
+
# Add new section or update existing content
|
|
407
|
+
vi mcp/team-standards/style-guide.md
|
|
408
|
+
----
|
|
409
|
+
|
|
410
|
+
Changes take effect immediately - just restart Claude Code.
|
|
411
|
+
|
|
412
|
+
=== Update terminology
|
|
413
|
+
|
|
414
|
+
Terminology is maintained in the official glossary sources:
|
|
415
|
+
|
|
416
|
+
- GitHub: https://github.com/redpanda-data/docs/tree/shared/modules/terms/partials (each term is a separate file)
|
|
417
|
+
- Published glossary: https://docs.redpanda.com/current/reference/glossary/
|
|
418
|
+
|
|
419
|
+
The style guide (`mcp/team-standards/style-guide.md`) includes a quick reference to common terms that points to the official glossary.
|
|
420
|
+
|
|
421
|
+
To add or update terms, update the glossary source files in the docs repository.
|
|
422
|
+
|
|
423
|
+
=== Update templates
|
|
424
|
+
|
|
425
|
+
Edit template files in `mcp/team-standards/`:
|
|
426
|
+
|
|
427
|
+
[source,bash]
|
|
428
|
+
----
|
|
429
|
+
# Example: Update a template resource
|
|
430
|
+
vi mcp/team-standards/api-template.md
|
|
431
|
+
----
|
|
432
|
+
|
|
433
|
+
Changes are immediately available to AI after restarting Claude Code.
|
|
434
|
+
|
|
435
|
+
== Adding new tools
|
|
436
|
+
|
|
437
|
+
Tools require JavaScript knowledge, but the pattern is straightforward.
|
|
438
|
+
|
|
439
|
+
=== When to add a new tool
|
|
440
|
+
|
|
441
|
+
Add a tool when you need to:
|
|
442
|
+
- Execute a doc-tools command that isn't covered
|
|
443
|
+
- Automate a multi-step process
|
|
444
|
+
- Integrate with external systems
|
|
445
|
+
- Perform custom validation
|
|
446
|
+
|
|
447
|
+
=== Tool template
|
|
448
|
+
|
|
449
|
+
Create a new file in `bin/mcp-tools/my-new-tool.js`:
|
|
450
|
+
|
|
451
|
+
[source,javascript]
|
|
452
|
+
----
|
|
453
|
+
const { executeCommand, findRepoRoot } = require('./utils');
|
|
454
|
+
|
|
455
|
+
/**
|
|
456
|
+
* Execute my new tool
|
|
457
|
+
* @param {Object} args - Tool arguments
|
|
458
|
+
* @returns {Object} Result with success flag and data
|
|
459
|
+
*/
|
|
460
|
+
function myNewTool(args) {
|
|
461
|
+
try {
|
|
462
|
+
// Validate arguments
|
|
463
|
+
if (!args.required_param) {
|
|
464
|
+
return {
|
|
465
|
+
success: false,
|
|
466
|
+
error: 'Missing required parameter: required_param'
|
|
467
|
+
};
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
// Build command
|
|
471
|
+
const command = ['my-command', args.required_param];
|
|
472
|
+
|
|
473
|
+
if (args.optional_param) {
|
|
474
|
+
command.push('--flag', args.optional_param);
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
// Execute
|
|
478
|
+
const result = executeCommand(command);
|
|
479
|
+
|
|
480
|
+
if (result.code === 0) {
|
|
481
|
+
return {
|
|
482
|
+
success: true,
|
|
483
|
+
message: 'Operation completed successfully',
|
|
484
|
+
output: result.stdout
|
|
485
|
+
};
|
|
486
|
+
} else {
|
|
487
|
+
return {
|
|
488
|
+
success: false,
|
|
489
|
+
error: result.stderr,
|
|
490
|
+
suggestion: 'Check the parameters and try again'
|
|
491
|
+
};
|
|
492
|
+
}
|
|
493
|
+
} catch (error) {
|
|
494
|
+
return {
|
|
495
|
+
success: false,
|
|
496
|
+
error: error.message
|
|
497
|
+
};
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
module.exports = { myNewTool };
|
|
502
|
+
----
|
|
503
|
+
|
|
504
|
+
Then register it in `bin/mcp-tools/index.js` and `bin/doc-tools-mcp.js`.
|
|
505
|
+
|
|
506
|
+
For tools, consider asking a developer for help or use this guide as a starting point.
|
|
507
|
+
|
|
508
|
+
== Testing your changes
|
|
509
|
+
|
|
510
|
+
=== Validation command
|
|
511
|
+
|
|
512
|
+
Before committing changes, **always run validation**:
|
|
513
|
+
|
|
514
|
+
[source,bash]
|
|
515
|
+
----
|
|
516
|
+
npx doc-tools validate-mcp
|
|
517
|
+
----
|
|
518
|
+
|
|
519
|
+
This command checks:
|
|
520
|
+
|
|
521
|
+
* All prompts load correctly and have valid frontmatter
|
|
522
|
+
* All resources are accessible
|
|
523
|
+
* Metadata is complete (descriptions, versions)
|
|
524
|
+
* No syntax errors in YAML or JSON
|
|
525
|
+
* No naming conflicts
|
|
526
|
+
|
|
527
|
+
Expected output:
|
|
528
|
+
|
|
529
|
+
[source,text]
|
|
530
|
+
----
|
|
531
|
+
Loading prompts...
|
|
532
|
+
Found 6 prompts
|
|
533
|
+
|
|
534
|
+
Validating configuration...
|
|
535
|
+
|
|
536
|
+
MCP Configuration Validation
|
|
537
|
+
============================================================
|
|
538
|
+
|
|
539
|
+
Prompts found: 6
|
|
540
|
+
Resources found: 1
|
|
541
|
+
|
|
542
|
+
✓ Validation passed
|
|
543
|
+
----
|
|
544
|
+
|
|
545
|
+
If validation fails, fix the errors before proceeding.
|
|
546
|
+
|
|
547
|
+
=== Preview command
|
|
548
|
+
|
|
549
|
+
Test a prompt without Claude Code:
|
|
550
|
+
|
|
551
|
+
[source,bash]
|
|
552
|
+
----
|
|
553
|
+
# Preview a review prompt
|
|
554
|
+
npx doc-tools preview-prompt review-for-style --content "Test content"
|
|
555
|
+
|
|
556
|
+
# Preview a write prompt
|
|
557
|
+
npx doc-tools preview-prompt write-new-guide --topic "Deploy cluster"
|
|
558
|
+
----
|
|
559
|
+
|
|
560
|
+
This shows exactly how your prompt will appear with arguments.
|
|
561
|
+
|
|
562
|
+
=== Test checklist
|
|
563
|
+
|
|
564
|
+
After adding or updating anything:
|
|
565
|
+
|
|
566
|
+
. Run validation:
|
|
567
|
+
+
|
|
568
|
+
[source,bash]
|
|
569
|
+
----
|
|
570
|
+
npx doc-tools validate-mcp
|
|
571
|
+
----
|
|
572
|
+
|
|
573
|
+
. Preview your prompt (if you added/changed one):
|
|
574
|
+
+
|
|
575
|
+
[source,bash]
|
|
576
|
+
----
|
|
577
|
+
npx doc-tools preview-prompt [prompt-name] --content "Sample text"
|
|
578
|
+
----
|
|
579
|
+
|
|
580
|
+
. Restart Claude Code to load changes
|
|
581
|
+
|
|
582
|
+
. List available items in Claude Code:
|
|
583
|
+
+
|
|
584
|
+
[source,text]
|
|
585
|
+
----
|
|
586
|
+
List available prompts
|
|
587
|
+
List available resources
|
|
588
|
+
List available tools
|
|
589
|
+
----
|
|
590
|
+
|
|
591
|
+
. Test the new item:
|
|
592
|
+
+
|
|
593
|
+
[source,text]
|
|
594
|
+
----
|
|
595
|
+
Use the [prompt-name] prompt
|
|
596
|
+
Read resource redpanda://[resource-name]
|
|
597
|
+
Use the [tool-name] tool
|
|
598
|
+
----
|
|
599
|
+
|
|
600
|
+
. Verify output is what you expected
|
|
601
|
+
. Check for errors in Claude Code console
|
|
602
|
+
|
|
603
|
+
=== Common issues
|
|
604
|
+
|
|
605
|
+
Validation fails with "Invalid frontmatter":
|
|
606
|
+
- Check YAML syntax in the frontmatter block
|
|
607
|
+
- Ensure required fields are present (description)
|
|
608
|
+
- Verify argument names use only lowercase and underscores
|
|
609
|
+
- Check that version follows semantic versioning (for example, "1.0.0")
|
|
610
|
+
|
|
611
|
+
Prompt not appearing:
|
|
612
|
+
- Run `npx doc-tools validate-mcp` to check for errors
|
|
613
|
+
- Verify file is in `mcp/prompts/` directory and ends with `.md`
|
|
614
|
+
- Check that frontmatter is valid YAML
|
|
615
|
+
- Restart Claude Code
|
|
616
|
+
|
|
617
|
+
Resource not loading:
|
|
618
|
+
- Run `npx doc-tools validate-mcp` to check for errors
|
|
619
|
+
- Verify file is in `mcp/team-standards/` directory
|
|
620
|
+
- Check for JSON syntax errors (if JSON file)
|
|
621
|
+
- Restart Claude Code
|
|
622
|
+
|
|
623
|
+
Prompt content not updating:
|
|
624
|
+
- Files are cached - restart Claude Code
|
|
625
|
+
- Check for syntax errors in Markdown or frontmatter
|
|
626
|
+
- Run validation to catch issues
|
|
627
|
+
|
|
628
|
+
== Best practices
|
|
629
|
+
|
|
630
|
+
=== For prompts
|
|
631
|
+
|
|
632
|
+
. Be specific - Tell AI exactly what to check or create
|
|
633
|
+
. Provide examples - Show good vs bad
|
|
634
|
+
. Reference resources - Point to style guide and terminology
|
|
635
|
+
. Define output format - Specify structure for consistency
|
|
636
|
+
. Include context - Explain why rules matter
|
|
637
|
+
|
|
638
|
+
=== For resources
|
|
639
|
+
|
|
640
|
+
. Keep them current - Update when standards change
|
|
641
|
+
. Make them scannable - Use clear headings and examples
|
|
642
|
+
. Show, don't just tell - Include examples
|
|
643
|
+
. Link to sources - Reference official docs when relevant
|
|
644
|
+
. Version control - Commit changes with clear descriptions
|
|
645
|
+
|
|
646
|
+
=== For the team
|
|
647
|
+
|
|
648
|
+
. Document changes - Update this guide when you learn something
|
|
649
|
+
. Share examples - Add good prompts to examples gallery
|
|
650
|
+
. Test thoroughly - Don't skip the testing checklist
|
|
651
|
+
. Ask for help - Reach out when you need developer support
|
|
652
|
+
. Iterate - Improve prompts based on usage and feedback
|
|
653
|
+
|
|
654
|
+
== Quick reference
|
|
655
|
+
|
|
656
|
+
=== File locations
|
|
657
|
+
|
|
658
|
+
[source,text]
|
|
659
|
+
----
|
|
660
|
+
mcp/
|
|
661
|
+
├── prompts/ # Prompt files (.md) - Auto-discovered!
|
|
662
|
+
│ ├── review-for-style.md
|
|
663
|
+
│ ├── write-new-guide.md
|
|
664
|
+
│ └── [your-prompt].md
|
|
665
|
+
├── team-standards/ # Resource files (.md) - Auto-discovered!
|
|
666
|
+
│ ├── style-guide.md
|
|
667
|
+
│ └── [your-resource].md
|
|
668
|
+
└── WRITER_EXTENSION_GUIDE.adoc # This file!
|
|
669
|
+
|
|
670
|
+
bin/
|
|
671
|
+
├── doc-tools-mcp.js # MCP server (no editing needed!)
|
|
672
|
+
└── mcp-tools/ # Tool implementations (advanced)
|
|
673
|
+
----
|
|
674
|
+
|
|
675
|
+
=== Common edits
|
|
676
|
+
|
|
677
|
+
Add a prompt:
|
|
678
|
+
. Create `mcp/prompts/my-prompt.md` with YAML frontmatter
|
|
679
|
+
. Run `npx doc-tools validate-mcp` to check for errors
|
|
680
|
+
. Restart Claude Code
|
|
681
|
+
. Test it!
|
|
682
|
+
|
|
683
|
+
Add a resource:
|
|
684
|
+
. Create `mcp/team-standards/my-resource.md`
|
|
685
|
+
. Run `npx doc-tools validate-mcp` to verify it's accessible
|
|
686
|
+
. Restart Claude Code
|
|
687
|
+
. Reference it in prompts using `redpanda://my-resource`
|
|
688
|
+
|
|
689
|
+
Update content:
|
|
690
|
+
. Edit the file in `mcp/prompts/` or `mcp/team-standards/`
|
|
691
|
+
. Run `npx doc-tools validate-mcp` to catch any errors
|
|
692
|
+
. Restart Claude Code
|
|
693
|
+
. Test the changes
|
|
694
|
+
|
|
695
|
+
=== Getting help
|
|
696
|
+
|
|
697
|
+
For writers:
|
|
698
|
+
- Review examples in existing prompts
|
|
699
|
+
- Check the showcase document for patterns
|
|
700
|
+
- Ask team lead for guidance
|
|
701
|
+
|
|
702
|
+
For developers:
|
|
703
|
+
- See `mcp/DEVELOPMENT.adoc` for technical details
|
|
704
|
+
- Check MCP SDK documentation
|
|
705
|
+
- Review tool implementation examples
|
|
706
|
+
|
|
707
|
+
== Examples gallery
|
|
708
|
+
|
|
709
|
+
=== Example 1: Simple review prompt
|
|
710
|
+
|
|
711
|
+
File: `mcp/prompts/review-troubleshooting.md`
|
|
712
|
+
|
|
713
|
+
[source,markdown]
|
|
714
|
+
----
|
|
715
|
+
---
|
|
716
|
+
description: "Review troubleshooting guides for required elements and clarity"
|
|
717
|
+
version: "1.0.0"
|
|
718
|
+
arguments:
|
|
719
|
+
content:
|
|
720
|
+
description: "Troubleshooting content to review"
|
|
721
|
+
required: true
|
|
722
|
+
---
|
|
723
|
+
|
|
724
|
+
# Review Troubleshooting Guide
|
|
725
|
+
|
|
726
|
+
Review troubleshooting documentation for clarity and completeness.
|
|
727
|
+
|
|
728
|
+
## Required Elements
|
|
729
|
+
|
|
730
|
+
Every troubleshooting guide must have:
|
|
731
|
+
1. Clear problem statement
|
|
732
|
+
2. Symptoms users would see
|
|
733
|
+
3. Root cause explanation
|
|
734
|
+
4. Step-by-step solution
|
|
735
|
+
5. Verification steps
|
|
736
|
+
|
|
737
|
+
## Check For
|
|
738
|
+
|
|
739
|
+
- Problem statement is specific (not vague)
|
|
740
|
+
- Symptoms are observable by users
|
|
741
|
+
- Solution steps are sequential and complete
|
|
742
|
+
- Commands include expected output
|
|
743
|
+
- Uses glossterm macro for technical terms
|
|
744
|
+
|
|
745
|
+
## Output Format
|
|
746
|
+
|
|
747
|
+
List missing elements and unclear sections.
|
|
748
|
+
|
|
749
|
+
---
|
|
750
|
+
|
|
751
|
+
Provide the troubleshooting content to review.
|
|
752
|
+
----
|
|
753
|
+
|
|
754
|
+
That's it! Save the file, run `npx doc-tools validate-mcp`, restart Claude Code, and it's ready to use.
|
|
755
|
+
|
|
756
|
+
=== Example 2: Reference resource
|
|
757
|
+
|
|
758
|
+
File: `mcp/team-standards/code-examples-guide.md`
|
|
759
|
+
|
|
760
|
+
[source,markdown]
|
|
761
|
+
----
|
|
762
|
+
# Code Examples Guide
|
|
763
|
+
|
|
764
|
+
## General Rules
|
|
765
|
+
|
|
766
|
+
- Always include context before code
|
|
767
|
+
- Show expected output after commands
|
|
768
|
+
- Use realistic examples (not foo/bar)
|
|
769
|
+
- Test all code before publishing
|
|
770
|
+
|
|
771
|
+
## AsciiDoc Format
|
|
772
|
+
|
|
773
|
+
Use appropriate roles:
|
|
774
|
+
|
|
775
|
+
[source,bash]
|
|
776
|
+
----
|
|
777
|
+
rpk topic create orders --partitions 3
|
|
778
|
+
----
|
|
779
|
+
|
|
780
|
+
[source,bash,role=no-copy]
|
|
781
|
+
----
|
|
782
|
+
TOPIC STATUS
|
|
783
|
+
orders OK
|
|
784
|
+
----
|
|
785
|
+
|
|
786
|
+
## Language-Specific Rules
|
|
787
|
+
|
|
788
|
+
### Bash
|
|
789
|
+
- Include comments for non-obvious commands
|
|
790
|
+
- Show full command with all flags
|
|
791
|
+
- Use long-form flags when clearer
|
|
792
|
+
|
|
793
|
+
### Python
|
|
794
|
+
- Follow PEP 8 style
|
|
795
|
+
- Include import statements
|
|
796
|
+
- Show complete, runnable examples
|
|
797
|
+
|
|
798
|
+
### YAML
|
|
799
|
+
- Use 2-space indentation
|
|
800
|
+
- Include comments for complex sections
|
|
801
|
+
- Validate syntax before publishing
|
|
802
|
+
----
|
|
803
|
+
|
|
804
|
+
That's it! Save the file, run `npx doc-tools validate-mcp`, restart Claude Code, and it's available as `redpanda://code-examples-guide`.
|
|
805
|
+
|
|
806
|
+
== What's next?
|
|
807
|
+
|
|
808
|
+
. Try adding a simple prompt using the templates above
|
|
809
|
+
. Update existing resources to match your current standards
|
|
810
|
+
. Share your additions with the team
|
|
811
|
+
. Document new patterns you discover
|
|
812
|
+
. Iterate and improve based on team feedback
|
|
813
|
+
|
|
814
|
+
Remember: The goal is to make AI work consistently for your entire docs team. Every prompt and resource you add makes that easier!
|