Elffuss BraidHub

kikocis/continue public

9df0fa5d79c7 · 17.2 KiBRawPermalink
1---
2title: "Context Providers"
3description: "Context Providers allow you to type '@' and see a dropdown of content that can all be fed to the LLM as context. Every context provider is a plugin, which means if you want to reference some source of information that you don't see here, you can request (or build!) a new context provider."
4---
5
6As an example, say you are working on solving a new GitHub Issue. You type '@Issue' and select the one you are working on. Continue can now see the issue title and contents. You also know that the issue is related to the files 'readme.md' and 'helloNested.py', so you type '@readme' and '@hello' to find and select them. Now these 3 "Context Items" are displayed inline with the rest of your input.
7
8![Context Items](/images/customize/images/context-provider-example-0c96ff77286fa970b23dddfdc1fa986a.png)
9
10## Context blocks
11
12You can add context providers to assistants using [`context` blocks](/hub/blocks/block-types#context). Explore available context blocks in [the hub](https://hub.continue.dev/explore/context).
13
14## Built-in Context Providers
15
16You can add any built-in context-providers in your config file as shown below:
17
18### `@File`
19
20Reference any file in your current workspace.
21
22- YAML
23- JSON
24
25config.yaml
26
27```
28context: - provider: file
29```
30
31config.json
32
33```json
34{ "contextProviders": [{ "name": "file" }] }
35```
36
37### `@Code`
38
39Reference specific functions or classes from throughout your project.
40
41- YAML
42- JSON
43
44config.yaml
45
46```
47context: - provider: code
48```
49
50config.json
51
52```json
53{ "contextProviders": [{ "name": "code" }] }
54```
55
56### `@Git Diff`
57
58Reference all of the changes you've made to your current branch. This is useful if you want to summarize what you've done or ask for a general review of your work before committing.
59
60- YAML
61- JSON
62
63config.yaml
64
65```
66context: - provider: diff
67```
68
69config.json
70
71```json
72{ "contextProviders": [{ "name": "diff" }] }
73```
74
75### `@Current File`
76
77Reference the currently open file.
78
79- YAML
80- JSON
81
82config.yaml
83
84```
85context: - provider: currentFile
86```
87
88config.json
89
90```json
91{ "contextProviders": [{ "name": "currentFile" }] }
92```
93
94### `@Terminal`
95
96Reference the last command you ran in your IDE's terminal and its output.
97
98- YAML
99- JSON
100
101config.yaml
102
103```
104context: - provider: terminal
105```
106
107config.json
108
109```json
110{ "contextProviders": [{ "name": "terminal" }] }
111```
112
113### `@Docs`
114
115Reference the contents from any documentation site.
116
117- YAML
118- JSON
119
120config.yaml
121
122```
123context: - provider: docs
124```
125
126config.json
127
128```json
129{ "contextProviders": [{ "name": "docs" }] }
130```
131
132Note that this will only enable the `@Docs` context provider.
133
134To use it, you need to add a documentation site to your config file. See the [docs](/customization/overview#documentation-context) page for more information.
135
136### `@Open`
137
138Reference the contents of all of your open files. Set `onlyPinned` to `true` to only reference pinned files.
139
140- YAML
141- JSON
142
143config.yaml
144
145```
146context: - provider: open params: onlyPinned: true
147```
148
149config.json
150
151```json
152{ "contextProviders": [{ "name": "open", "params": { "onlyPinned": true } }] }
153```
154
155### `@Web`
156
157Reference relevant pages from across the web, automatically determined from your input.
158
159Optionally, set `n` to limit the number of results returned (default 6).
160
161- YAML
162- JSON
163
164config.yaml
165
166```
167context: - provider: web params: n: 5
168```
169
170config.json
171
172```json
173{ "contextProviders": [{ "name": "web", "params": { "n": 5 } }] }
174```
175
176### `@Codebase`
177
178Reference the most relevant snippets from your codebase.
179
180- YAML
181- JSON
182
183config.yaml
184
185```
186context: - provider: codebase
187```
188
189config.json
190
191```json
192{ "contextProviders": [{ "name": "codebase" }] }
193```
194
195Read more about indexing and retrieval [here](/customization/overview#codebase-context).
196
197### `@Folder`
198
199Uses the same retrieval mechanism as `@Codebase`, but only on a single folder.
200
201- YAML
202- JSON
203
204config.yaml
205
206```
207context: - provider: folder
208```
209
210config.json
211
212```json
213{ "contextProviders": [{ "name": "folder" }] }
214```
215
216### `@Search`
217
218Reference the results of codebase search, just like the results you would get from VS Code search.
219
220- YAML
221- JSON
222
223config.yaml
224
225```
226context: - provider: search params: maxResults: 100 # optional, defaults to 200
227```
228
229config.json
230
231```json
232{ "contextProviders": [ { "name": "search", "params": { "maxResults": 100 // optional, defaults to 200 } } ]}
233```
234
235This context provider is powered by [ripgrep](https://github.com/BurntSushi/ripgrep).
236
237### `@Url`
238
239Reference the markdown converted contents of a given URL.
240
241- YAML
242- JSON
243
244config.yaml
245
246```
247context: - provider: url
248```
249
250config.json
251
252```json
253{ "contextProviders": [{ "name": "url" }] }
254```
255
256### `@Clipboard`
257
258Reference recent clipboard items
259
260- YAML
261- JSON
262
263config.yaml
264
265```
266context: - provider: clipboard
267```
268
269config.json
270
271```json
272{ "contextProviders": [{ "name": "clipboard" }] }
273```
274
275### `@Tree`
276
277Reference the structure of your current workspace.
278
279- YAML
280- JSON
281
282config.yaml
283
284```
285context: - provider: tree
286```
287
288config.json
289
290```json
291{ "contextProviders": [{ "name": "tree" }] }
292```
293
294### `@Problems`
295
296Get Problems from the current file.
297
298- YAML
299- JSON
300
301config.yaml
302
303```
304context: - provider: problems
305```
306
307config.json
308
309```json
310{ "contextProviders": [{ "name": "problems" }] }
311```
312
313### `@Debugger`
314
315Reference the contents of the local variables in the debugger. Currently only available in VS Code.
316
317- YAML
318- JSON
319
320config.yaml
321
322```
323context: - provider: debugger params: stackDepth: 3
324```
325
326config.json
327
328```json
329{ "contextProviders": [{ "name": "debugger", "params": { "stackDepth": 3 } }] }
330```
331
332Uses the top _n_ levels (defaulting to 3) of the call stack for that thread.
333
334### `@Repository Map`
335
336Reference the outline of your codebase. By default, signatures are included along with file in the repo map.
337
338`includeSignatures` params can be set to false to exclude signatures. This could be necessary for large codebases and/or to reduce context size significantly. Signatures will not be included if indexing is disabled.
339
340- YAML
341- JSON
342
343config.yaml
344
345```
346context: - provider: repo-map params: includeSignatures: false # default true
347```
348
349config.json
350
351```json
352{ "contextProviders": [ { "name": "repo-map", "params": { "includeSignatures": false // default true } } ]}
353```
354
355Provides a list of files and the call signatures of top-level classes, functions, and methods in those files. This helps the model better understand how a particular piece of code relates to the rest of the codebase.
356
357In the submenu that appears, you can select either `Entire codebase`, or specify a subfolder to generate the repostiory map from.
358
359This context provider is inpsired by [Aider's repository map](https://aider.chat/2023/10/22/repomap.html).
360
361### `@Operating System`
362
363Reference the architecture and platform of your current operating system.
364
365- YAML
366- JSON
367
368config.yaml
369
370```
371context: - provider: os
372```
373
374config.json
375
376```json
377{ "contextProviders": [{ "name": "os" }] }
378```
379
380### Model Context Protocol
381
382The [Model Context Protocol](https://modelcontextprotocol.io/introduction) is a standard proposed by Anthropic to unify prompts, context, and tool use. Continue supports any MCP server with the MCP context provider. Read their [quickstart](https://modelcontextprotocol.io/quickstart) to learn how to set up a local server and then set up your configuration like this:
383
384- YAML
385- JSON
386
387config.yaml
388
389```
390mcpServers: - name: My MCP Server command: uvx args: - mcp-server-sqlite - --db-path - /Users/NAME/test.db
391```
392
393config.json
394
395```json
396{
397 "experimental": {
398 "modelContextProtocolServers": [
399 {
400 "transport": {
401 "type": "stdio",
402 "command": "uvx",
403 "args": ["mcp-server-sqlite", "--db-path", "/Users/NAME/test.db"]
404 }
405 }
406 ]
407 }
408}
409```
410
411You'll then be able to type "@" and see "MCP" in the context providers dropdown.
412
413### `@Issue`
414
415Reference the conversation in a GitHub issue.
416
417- YAML
418- JSON
419
420config.yaml
421
422```
423context: - provider: issue params: repos: - owner: continuedev repo: continue githubToken: ghp_xxx
424```
425
426config.json
427
428```json
429{
430 "contextProviders": [
431 {
432 "name": "issue",
433 "params": {
434 "repos": [{ "owner": "continuedev", "repo": "continue" }],
435 "githubToken": "ghp_xxx"
436 }
437 }
438 ]
439}
440```
441
442Make sure to include your own [GitHub personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-fine-grained-personal-access-token) to avoid being rate-limited.
443
444### `@Database`
445
446Reference table schemas from Sqlite, Postgres, MSSQL, and MySQL databases.
447
448- YAML
449- JSON
450
451config.yaml
452
453```
454context: - provider: database params: connections: - name: examplePostgres connection_type: postgres connection: user: username host: localhost database: exampleDB password: yourPassword port: 5432 - name: exampleMssql connection_type: mssql connection: user: username server: localhost database: exampleDB password: yourPassword - name: exampleSqlite connection_type: sqlite connection: filename: /path/to/your/sqlite/database.db
455```
456
457config.json
458
459```json
460{
461 "contextProviders": [
462 {
463 "name": "database",
464 "params": {
465 "connections": [
466 {
467 "name": "examplePostgres",
468 "connection_type": "postgres",
469 "connection": {
470 "user": "username",
471 "host": "localhost",
472 "database": "exampleDB",
473 "password": "yourPassword",
474 "port": 5432
475 }
476 },
477 {
478 "name": "exampleMssql",
479 "connection_type": "mssql",
480 "connection": {
481 "user": "username",
482 "server": "localhost",
483 "database": "exampleDB",
484 "password": "yourPassword"
485 }
486 },
487 {
488 "name": "exampleSqlite",
489 "connection_type": "sqlite",
490 "connection": { "filename": "/path/to/your/sqlite/database.db" }
491 }
492 ]
493 }
494 }
495 ]
496}
497```
498
499Each connection should include a unique name, the `connection_type`, and the necessary connection parameters specific to each database type.
500
501Available connection types:
502
503- `postgres`
504- `mysql`
505- `sqlite`
506
507### `@Postgres`
508
509Reference the schema of a table, and some sample rows
510
511- YAML
512- JSON
513
514config.yaml
515
516```
517context: - provider: postgres params: host: localhost port: 5436 user: myuser password: catsarecool database: animals schema: public sampleRows: 3
518```
519
520config.json
521
522```json
523{
524 "contextProviders": [
525 {
526 "name": "postgres",
527 "params": {
528 "host": "localhost",
529 "port": 5436,
530 "user": "myuser",
531 "password": "catsarecool",
532 "database": "animals",
533 "schema": "public",
534 "sampleRows": 3
535 }
536 }
537 ]
538}
539```
540
541The only required settings are those for creating the database connection: `host`, `port`, `user`, `password`, and `database`.
542
543By default, the `schema` filter is set to `public`, and the `sampleRows` is set to 3. You may unset the schema if you want to include tables from all schemas.
544
545[Here is a short demo.](https://github.com/continuedev/continue/pull/859)
546
547### `@Google`
548
549Reference the results of a Google search.
550
551- YAML
552- JSON
553
554config.yaml
555
556```
557context: - provider: google params: serperApiKey: <YOUR_SERPER.DEV_API_KEY>
558```
559
560config.json
561
562```json
563{
564 "contextProviders": [
565 {
566 "name": "google",
567 "params": { "serperApiKey": "<YOUR_SERPER.DEV_API_KEY>" }
568 }
569 ]
570}
571```
572
573For example, type "@Google python tutorial" if you want to search and discuss ways of learning Python.
574
575Note: You can get an API key for free at [serper.dev](https://serper.dev).
576
577### `@Gitlab Merge Request`
578
579Reference an open MR for this branch on GitLab.
580
581- YAML
582- JSON
583
584config.yaml
585
586```
587context: - provider: gitlab-mr params: token: "..."
588```
589
590config.json
591
592```json
593{ "contextProviders": [{ "name": "gitlab-mr", "params": { "token": "..." } }] }
594```
595
596You will need to create a [personal access token](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html) with the `read_api` scope.
597
598#### Using Self-Hosted GitLab
599
600You can specify the domain to communicate with by setting the `domain` parameter in your configurtion. By default this is set to `gitlab.com`.
601
602- YAML
603- JSON
604
605config.yaml
606
607```
608context: - provider: gitlab-mr params: token: "..." domain: "gitlab.example.com"
609```
610
611config.json
612
613```json
614{
615 "contextProviders": [
616 {
617 "name": "gitlab-mr",
618 "params": { "token": "...", "domain": "gitlab.example.com" }
619 }
620 ]
621}
622```
623
624#### Filtering Comments
625
626If you select some code to be edited, you can have the context provider filter out comments for other files. To enable this feature, set `filterComments` to `true`.
627
628### `@Jira`
629
630Reference the conversation in a Jira issue.
631
632- YAML
633- JSON
634
635config.yaml
636
637```
638context: - provider: jira params: domain: company.atlassian.net token: ATATT...
639```
640
641config.json
642
643```json
644{
645 "contextProviders": [
646 {
647 "name": "jira",
648 "params": { "domain": "company.atlassian.net", "token": "ATATT..." }
649 }
650 ]
651}
652```
653
654Make sure to include your own [Atlassian API Token](https://id.atlassian.com/manage-profile/security/api-tokens), or use your `email` and `token`, with token set to your password for basic authentication. If you use your own Atlassian API Token, don't configure your email.
655
656#### Jira Datacenter Support
657
658This context provider supports both Jira API version 2 and 3. It will use version 3 by default since that's what the cloud version uses, but if you have the datacenter version of Jira, you'll need to set the API Version to 2 using the `apiVersion` property.
659
660- YAML
661- JSON
662
663config.yaml
664
665```
666context: - provider: jira params: apiVersion: "2"
667```
668
669config.json
670
671```json
672{ "contextProviders": [{ "name": "jira", "params": { "apiVersion": "2" } }] }
673```
674
675#### Issue Query
676
677By default, the following query will be used to find issues:
678
679```
680assignee = currentUser() AND resolution = Unresolved order by updated DESC
681```
682
683You can override this query by setting the `issueQuery` parameter.
684
685#### Max results
686
687You can set the `maxResults` parameter to limit the number of results returned. The default is `50`.
688
689### `@Discord`
690
691Reference the messages in a Discord channel.
692
693- YAML
694- JSON
695
696config.yaml
697
698```
699context: - provider: discord params: discordKey: "bot token" guildId: "1234567890" channels: - id: "123456" name: "example-channel" - id: "678901" name: "example-channel-2"
700```
701
702config.json
703
704```json
705{
706 "contextProviders": [
707 {
708 "name": "discord",
709 "params": {
710 "discordKey": "bot token",
711 "guildId": "1234567890",
712 "channels": [
713 { "id": "123456", "name": "example-channel" },
714 { "id": "678901", "name": "example-channel-2" }
715 ]
716 }
717 }
718 ]
719}
720```
721
722Make sure to include your own [Bot Token](https://discord.com/developers/applications), and join it to your related server . If you want more granular control over which channels are searched, you can specify a list of channel IDs to search in. If you don't want to specify any channels, just include the guild id(Server ID) and all channels will be included. The provider only reads text channels.
723
724### `@HTTP`
725
726The HttpContextProvider makes a POST request to the url passed in the configuration. The server must return 200 OK with a ContextItem object or an array of ContextItems.
727
728- YAML
729- JSON
730
731config.yaml
732
733```
734context: - provider: http params: url: "https://api.example.com/v1/users"
735```
736
737config.json
738
739```json
740{
741 "contextProviders": [
742 { "name": "http", "params": { "url": "https://api.example.com/v1/users" } }
743 ]
744}
745```
746
747The receiving URL should expect to receive the following parameters:
748
749POST parameters
750
751```json
752{ query: string, fullInput: string}
753```
754
755The response 200 OK should be a JSON object with the following structure:
756
757Response
758
759```
760[ { "name": "", "description": "", "content": "" }]// OR{ "name": "", "description": "", "content": ""}
761```
762
763### `@Commits`
764
765Reference specific git commit metadata and diff or all of the recent commits.
766
767- YAML
768- JSON
769
770config.yaml
771
772```
773context: - provider: commit params: Depth: 50 LastXCommitsDepth: 10
774```
775
776config.json
777
778```json
779{
780 "contextProviders": [
781 { "name": "commit", "params": { "Depth": 50, "LastXCommitsDepth": 10 } }
782 ]
783}
784```
785
786The depth is how many commits will be loaded into the submenu, defaults to 50. The LastXCommitsDepth is how many recent commits will be included, defaults to 10.
787
788### `@Greptile`
789
790Query a [Greptile](https://www.greptile.com/) index of the current repo/branch.
791
792- YAML
793- JSON
794
795config.yaml
796
797```
798context: - provider: greptile params: greptileToken: "..." githubToken: "..."
799```
800
801config.json
802
803```json
804{
805 "contextProviders": [
806 {
807 "name": "greptile",
808 "params": { "GreptileToken": "...", "GithubToken": "..." }
809 }
810 ]
811}
812```
813
814### Requesting Context Providers
815
816Not seeing what you want? Create an issue [here](https://github.com/continuedev/continue/issues/new?assignees=TyDunn&labels=enhancement&projects=&template=feature-request-%F0%9F%92%AA.md&title=) to request a new Context Provider.