Skip to content

Commit 0dd5605

Browse files
committed
Enhance documentation: add prompt listing and filtering sections with examples and usage details
1 parent e9e6321 commit 0dd5605

File tree

2 files changed

+240
-2
lines changed

2 files changed

+240
-2
lines changed

docs/getting-started/command-reference.md

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,4 +271,67 @@ ctx --inline='
271271
]
272272
}
273273
'
274-
```
274+
```
275+
276+
## List Available Prompts
277+
278+
Lists all available prompts with their IDs, types, descriptions, tags, and arguments.
279+
280+
```bash
281+
ctx prompts:list
282+
# or
283+
ctx prompts
284+
```
285+
286+
### Options
287+
288+
| Option | Description |
289+
|-----------------------|-------------------------------------------------------------------------|
290+
| `--config-file`, `-c` | Path to configuration file (absolute or relative to current directory). |
291+
| `--tag`, `-t` | Filter prompts by tag (can be used multiple times). |
292+
| `--exclude-tag`, `-x` | Exclude prompts with specific tag (can be used multiple times). |
293+
| `--id`, `-p` | Filter prompts by ID (can be used multiple times). |
294+
| `--detailed`, `-d` | Show detailed information including arguments. |
295+
296+
### Examples
297+
298+
**List all prompts in table format:**
299+
300+
```bash
301+
ctx prompts:list
302+
```
303+
304+
**Show detailed information with arguments:**
305+
306+
```bash
307+
ctx prompts:list --detailed
308+
# or
309+
ctx prompts -d
310+
```
311+
312+
**Filter prompts by tags:**
313+
314+
```bash
315+
ctx prompts:list --tag api --tag documentation
316+
# or
317+
ctx prompts -t api -t documentation
318+
```
319+
320+
**Exclude prompts with specific tags:**
321+
322+
```bash
323+
ctx prompts:list --exclude-tag experimental
324+
# or
325+
ctx prompts -x experimental
326+
```
327+
328+
**Filter prompts by ID:**
329+
330+
```bash
331+
ctx prompts:list --id system-prompt --id user-query
332+
# or
333+
ctx prompts -p system-prompt -p user-query
334+
```
335+
336+
This command helps you discover and explore available prompts in your configuration, making it easier to understand what
337+
prompts are available for use with the MCP server.

docs/mcp/prompts.md

Lines changed: 176 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ prompts can serve as starting points for common tasks, code generation, or proje
1919
- [Import](#import)
2020
- [Import Capabilities](#import-capabilities)
2121
- [Example Import Configuration](#example-import-configuration)
22+
- [Tagging Prompts](#tagging-prompts)
23+
- [Filtered Imports](#filtered-imports)
24+
- [Filtering by IDs](#filtering-by-ids)
25+
- [Filtering by Tags](#filtering-by-tags)
26+
- [Combining Filter Types](#combining-filter-types)
27+
- [Match Strategies](#match-strategies)
2228

2329
## How Prompts Work
2430

@@ -328,4 +334,173 @@ import:
328334
```
329335

330336
> **Note**: There is an example of shared prompts
331-
> on [Gist](https://gist.github.com/butschster/1b7e597691cc1a6476b15dc120ecbddb) that can be used as a starting point.
337+
> on [Gist](https://gist.github.com/butschster/1b7e597691cc1a6476b15dc120ecbddb) that can be used as a starting point.
338+
339+
## Prompt Tagging and Filtering
340+
341+
CTX allows you to organize prompts with tags and selectively import them based on these tags or their IDs. This helps
342+
manage large prompt collections and create specialized subsets of prompts for different contexts or use cases.
343+
344+
### Tagging Prompts
345+
346+
Tags are simple string labels that you can assign to prompts to categorize them:
347+
348+
```yaml
349+
prompts:
350+
- id: python-helper
351+
description: "Helps with Python code and concepts"
352+
tags: [ "python", "coding", "development" ]
353+
messages:
354+
- role: user
355+
content: "You are a Python coding assistant. Help me write efficient Python code."
356+
357+
- id: creative-writing
358+
description: "Helps generate creative writing pieces"
359+
tags: [ "writing", "creative", "content-generation" ]
360+
messages:
361+
- role: user
362+
content: "You are a creative writing assistant. Help me generate compelling stories."
363+
```
364+
365+
Tags can be used to categorize prompts by:
366+
367+
- Domain (e.g., "writing", "coding", "data")
368+
- Skill level (e.g., "beginner", "advanced")
369+
- Purpose (e.g., "brainstorming", "debugging", "analysis")
370+
- Any other organizational scheme that fits your needs
371+
372+
### Filtered Imports
373+
374+
When importing prompts from external sources, you can selectively include only the prompts that match specific criteria
375+
using filters.
376+
377+
#### Filtering by IDs
378+
379+
To import only specific prompts by their IDs:
380+
381+
```yaml
382+
import:
383+
- url: "https://example.com/prompts-repository.yaml"
384+
filter:
385+
ids: [ "python-helper", "php-debug", "js-refactor" ]
386+
```
387+
388+
This will only import the three specified prompts and ignore all others from the source.
389+
390+
#### Filtering by Tags
391+
392+
To import prompts based on their tags:
393+
394+
```yaml
395+
import:
396+
- path: "./local-prompts.yaml"
397+
filter:
398+
tags:
399+
include: [ "coding", "debugging" ]
400+
exclude: [ "advanced" ]
401+
match: "any" # Can be "all" for AND logic
402+
```
403+
404+
This filter will:
405+
406+
- Include prompts that have either the "coding" OR "debugging" tag (because `match: "any"`)
407+
- Exclude prompts that have the "advanced" tag, regardless of other tags
408+
409+
The `match` parameter determines how the `include` tags are evaluated:
410+
411+
- `any`: Include if the prompt has ANY of the specified tags (OR logic)
412+
- `all`: Include only if the prompt has ALL of the specified tags (AND logic)
413+
414+
#### Combining Filter Types
415+
416+
You can combine ID and tag filtering in a single import:
417+
418+
```yaml
419+
import:
420+
- path: "./prompt-collection.yaml"
421+
filter:
422+
ids:
423+
- creative-writing
424+
- summarization-prompt
425+
tags:
426+
include:
427+
- content
428+
exclude:
429+
- technical
430+
match: "any" # This applies to the overall filter strategy
431+
```
432+
433+
With combined filtering:
434+
435+
- The `match` parameter at the root level determines how different filter types (IDs and tags) are combined
436+
- `match: "any"` means prompts matching EITHER the ID criteria OR the tag criteria will be imported
437+
- `match: "all"` would require prompts to match BOTH the ID criteria AND the tag criteria
438+
439+
#### Match Strategies
440+
441+
Both tag filtering and combined filtering support two match strategies:
442+
443+
1. **ANY** strategy (`match: "any"`, default):
444+
- For tags: Include if the prompt has any of the specified include tags
445+
- For combined filters: Include if the prompt matches either the ID criteria or the tag criteria
446+
447+
2. **ALL** strategy (`match: "all"`):
448+
- For tags: Include only if the prompt has all of the specified include tags
449+
- For combined filters: Include only if the prompt matches both the ID criteria and the tag criteria
450+
451+
### Use Cases
452+
453+
#### Creating Domain-Specific Collections
454+
455+
Import only prompts related to a specific domain:
456+
457+
```yaml
458+
import:
459+
- url: "https://example.com/all-prompts.yaml"
460+
filter:
461+
tags:
462+
include: [ "writing", "content-generation" ]
463+
```
464+
465+
#### Excluding Advanced Prompts
466+
467+
Import all coding prompts except advanced ones:
468+
469+
```yaml
470+
import:
471+
- url: "https://example.com/coding-prompts.yaml"
472+
filter:
473+
tags:
474+
include: [ "coding" ]
475+
exclude: [ "advanced" ]
476+
```
477+
478+
#### Creating Curated Collections
479+
480+
Import a carefully selected set of prompts by their IDs:
481+
482+
```yaml
483+
import:
484+
- url: "https://example.com/prompt-repository.yaml"
485+
filter:
486+
ids:
487+
- python-helper
488+
- summarization-prompt
489+
- brainstorming
490+
```
491+
492+
#### Combining Tag-Based and ID-Based Filtering
493+
494+
Import prompts that are either in a specific category OR are specifically chosen:
495+
496+
```yaml
497+
import:
498+
- url: "https://example.com/prompts.yaml"
499+
filter:
500+
ids:
501+
- special-prompt-1
502+
- special-prompt-2
503+
tags:
504+
include: [ "recommended" ]
505+
match: "any" # Import if either the ID matches OR it has the "recommended" tag
506+
```

0 commit comments

Comments
 (0)