Skip to content

Commit 91f1640

Browse files
committed
add Docs Source section with usage examples and parameters
1 parent 1e820d6 commit 91f1640

File tree

2 files changed

+88
-1
lines changed

2 files changed

+88
-1
lines changed

docs/.vitepress/config.mts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ export default withMermaid({
6464
{text: 'Text Source', link: '/sources/text-source'},
6565
{text: 'Composer Source', link: '/sources/composer-source'},
6666
{text: 'Tree Source', link: '/sources/tree-source'},
67-
{text: 'MCP Source', link: '/sources/mcp-source'}
67+
{text: 'MCP Source', link: '/sources/mcp-source'},
68+
{text: 'Docs Source', link: '/sources/docs-source'},
6869
]
6970
},
7071
{

docs/sources/docs-source.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# Docs Source
2+
3+
Retrieve documentation from [Context7](https://context7.com/) service based on library, topic, and token limit.
4+
5+
```yaml
6+
documents:
7+
- description: Laravel Controller Documentation
8+
outputPath: docs/laravel-controllers.md
9+
sources:
10+
- type: docs
11+
library: "laravel/docs"
12+
topic: controller
13+
tokens: 600
14+
description: "Laravel controller documentation"
15+
tags: [ "laravel", "docs" ]
16+
```
17+
18+
## Parameters
19+
20+
| Parameter | Type | Default | Description |
21+
|---------------|---------|----------|-------------------------------------------|
22+
| `type` | string | required | Must be `"docs"` |
23+
| `library` | string | required | Library identifier (e.g., "laravel/docs") |
24+
| `topic` | string | required | Topic to search for within the library |
25+
| `tokens` | integer | 500 | Maximum token count to retrieve |
26+
| `description` | string | `""` | Human-readable description of the source |
27+
| `tags` | array | [] | List of tags for this source |
28+
29+
## How It Works
30+
31+
The Docs source connects to Context7's documentation service to retrieve targeted content based on:
32+
33+
1. **Library**: The repository identifier (like "laravel/docs" or "symfony/docs")
34+
2. **Topic**: A specific topic or keyword to search for within the library
35+
3. **Tokens**: The maximum number of tokens to retrieve (helpful for controlling context size)
36+
37+
This allows you to include highly relevant documentation in your context without including entire files or repositories.
38+
39+
## Example Use Cases
40+
41+
### API Documentation Reference
42+
43+
```yaml
44+
documents:
45+
- description: Laravel API Documentation
46+
outputPath: docs/laravel-api.md
47+
sources:
48+
- type: docs
49+
library: "laravel/docs"
50+
topic: "api"
51+
tokens: 1000
52+
```
53+
54+
### Multiple Documentation Sources
55+
56+
```yaml
57+
documents:
58+
- description: PHP Framework Comparison
59+
outputPath: docs/framework-comparison.md
60+
sources:
61+
- type: docs
62+
library: "laravel/docs"
63+
topic: "controller"
64+
tokens: 400
65+
description: "Laravel Controllers"
66+
- type: docs
67+
library: "symfony/docs"
68+
topic: "controller"
69+
tokens: 400
70+
description: "Symfony Controllers"
71+
```
72+
73+
## Using Environment Variables
74+
75+
Like other source types, you can use environment variables in your configuration:
76+
77+
```yaml
78+
documents:
79+
- description: Dynamic Documentation
80+
outputPath: docs/dynamic-docs.md
81+
sources:
82+
- type: docs
83+
library: "${DOC_LIBRARY}"
84+
topic: "${DOC_TOPIC}"
85+
tokens: ${DOC_TOKENS}
86+
```

0 commit comments

Comments
 (0)