Elffuss BraidHub

kikocis/continue public

b334cb9dcd5e · 17.8 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## How Do Context Blocks Work?
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 Context Provider – Reference Files in Your Workspace
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 Context Provider – Reference Functions and Classes
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 Context Provider – Reference Branch Changes
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 Context Provider – Reference the Active 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 Context Provider – Reference Last Terminal Command and Output
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 Context Provider – Reference Documentation Site Content
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](/customize/overview#documentation-context) page for more information.
135
136### @Open Context Provider – Reference All Open Files or Pinned Files
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:
147 - provider: open
148 params:
149 onlyPinned: true
150```
151
152config.json
153
154```json
155{ "contextProviders": [{ "name": "open", "params": { "onlyPinned": true } }] }
156```
157
158### @Web Context Provider – Reference Relevant Web Pages
159
160Reference relevant pages from across the web, automatically determined from your input.
161
162Optionally, set `n` to limit the number of results returned (default 6).
163
164- YAML
165- JSON
166
167config.yaml
168
169```
170context:
171 - provider: web
172 params:
173 n: 5
174```
175
176config.json
177
178```json
179{ "contextProviders": [{ "name": "web", "params": { "n": 5 } }] }
180```
181
182### @Codebase Context Provider – Reference Relevant Codebase Snippets
183
184Reference the most relevant snippets from your codebase.
185
186- YAML
187- JSON
188
189config.yaml
190
191```
192context:
193 - provider: codebase
194```
195
196config.json
197
198```json
199{ "contextProviders": [{ "name": "codebase" }] }
200```
201
202Read more about indexing and retrieval [here](/customize/overview#codebase-context).
203
204### @Folder Context Provider – Reference Code from a Specific Folder
205
206Uses the same retrieval mechanism as `@Codebase`, but only on a single folder.
207
208- YAML
209- JSON
210
211config.yaml
212
213```
214context: - provider: folder
215```
216
217config.json
218
219```json
220{ "contextProviders": [{ "name": "folder" }] }
221```
222
223### @Search Context Provider – Reference Code Search Results
224
225Reference the results of codebase search, just like the results you would get from VS Code search.
226
227- YAML
228- JSON
229
230config.yaml
231
232```
233context:
234 - provider: search
235 params:
236 maxResults: 100 # optional, defaults to 200
237```
238
239config.json
240
241```json
242{ "contextProviders": [ { "name": "search", "params": { "maxResults": 100 // optional, defaults to 200 } } ]}
243```
244
245This context provider is powered by [ripgrep](https://github.com/BurntSushi/ripgrep).
246
247### @Url Context Provider – Reference Content from a URL
248
249Reference the markdown converted contents of a given URL.
250
251- YAML
252- JSON
253
254config.yaml
255
256```
257context:
258 - provider: url
259```
260
261config.json
262
263```json
264{ "contextProviders": [{ "name": "url" }] }
265```
266
267### @Clipboard Context Provider – Reference Clipboard Items
268
269Reference recent clipboard items
270
271- YAML
272- JSON
273
274config.yaml
275
276```
277context:
278 - provider: clipboard
279```
280
281config.json
282
283```json
284{ "contextProviders": [{ "name": "clipboard" }] }
285```
286
287### @Tree Context Provider – Reference Workspace File Structure
288
289Reference the structure of your current workspace.
290
291- YAML
292- JSON
293
294config.yaml
295
296```
297context:
298 - provider: tree
299```
300
301config.json
302
303```json
304{ "contextProviders": [{ "name": "tree" }] }
305```
306
307### @Problems Context Provider – Reference Problems in the Current File
308
309Get Problems from the current file.
310
311- YAML
312- JSON
313
314config.yaml
315
316```
317context:
318 - provider: problems
319```
320
321config.json
322
323```json
324{ "contextProviders": [{ "name": "problems" }] }
325```
326
327### @Debugger Context Provider – Reference Debugger Local Variables
328
329Reference the contents of the local variables in the debugger. Currently only available in VS Code.
330
331- YAML
332- JSON
333
334config.yaml
335
336```
337context:
338 - provider: debugger
339 params:
340 stackDepth: 3
341```
342
343config.json
344
345```json
346{ "contextProviders": [{ "name": "debugger", "params": { "stackDepth": 3 } }] }
347```
348
349Uses the top _n_ levels (defaulting to 3) of the call stack for that thread.
350
351### @Repository Map Context Provider – Reference Codebase Outline and Signatures
352
353Reference the outline of your codebase. By default, signatures are included along with file in the repo map.
354
355`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.
356
357- YAML
358- JSON
359
360config.yaml
361
362```
363context:
364 - provider: repo-map
365 params:
366 includeSignatures: false # default true
367```
368
369config.json
370
371```json
372{ "contextProviders": [ { "name": "repo-map", "params": { "includeSignatures": false // default true } } ]}
373```
374
375Provides 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.
376
377In the submenu that appears, you can select either `Entire codebase`, or specify a subfolder to generate the repository map from.
378
379This context provider is inspired by [Aider's repository map](https://aider.chat/2023/10/22/repomap.html).
380
381### @Operating System Context Provider – Reference System Architecture and Platform
382
383Reference the architecture and platform of your current operating system.
384
385- YAML
386- JSON
387
388config.yaml
389
390```
391context:
392 - provider: os
393```
394
395config.json
396
397```json
398{ "contextProviders": [{ "name": "os" }] }
399```
400
401### Using the Model Context Protocol (MCP) in Continue
402
403The [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:
404
405- YAML
406- JSON
407
408config.yaml
409
410```
411mcpServers:
412 - name: My MCP Server
413 command: uvx
414 args:
415 - mcp-server-sqlite
416 - --db-path
417 - /Users/NAME/test.db
418```
419
420config.json
421
422```json
423{
424 "experimental": {
425 "modelContextProtocolServers": [
426 {
427 "transport": {
428 "type": "stdio",
429 "command": "uvx",
430 "args": ["mcp-server-sqlite", "--db-path", "/Users/NAME/test.db"]
431 }
432 }
433 ]
434 }
435}
436```
437
438You'll then be able to type "@" and see "MCP" in the context providers dropdown.
439
440### @Issue Context Provider – Reference GitHub Issue Conversations
441
442Reference the conversation in a GitHub issue.
443
444- YAML
445- JSON
446
447config.yaml
448
449```
450context:
451 - provider: issue
452 params:
453 repos:
454 - owner: continuedev
455 repo: continue
456 githubToken: ghp_xxx
457```
458
459config.json
460
461```json
462{
463 "contextProviders": [
464 {
465 "name": "issue",
466 "params": {
467 "repos": [{ "owner": "continuedev", "repo": "continue" }],
468 "githubToken": "ghp_xxx"
469 }
470 }
471 ]
472}
473```
474
475Make 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.
476
477### @Database Context Provider – Reference Database Table Schemas
478
479Reference table schemas from Sqlite, Postgres, MSSQL, and MySQL databases.
480
481- YAML
482- JSON
483
484config.yaml
485
486```
487context:
488 - provider: database
489 params:
490 connections:
491 - name: examplePostgres
492 connection_type: postgres
493 connection:
494 user: username
495 host: localhost
496 database: exampleDB
497 password: yourPassword
498 port: 5432
499 - name: exampleMssql
500 connection_type: mssql
501 connection:
502 user: username
503 server: localhost
504 database: exampleDB
505 password: yourPassword
506 - name: exampleSqlite
507 connection_type: sqlite
508 connection:
509 filename: /path/to/your/sqlite/database.db
510```
511
512config.json
513
514```json
515{
516 "contextProviders": [
517 {
518 "name": "database",
519 "params": {
520 "connections": [
521 {
522 "name": "examplePostgres",
523 "connection_type": "postgres",
524 "connection": {
525 "user": "username",
526 "host": "localhost",
527 "database": "exampleDB",
528 "password": "yourPassword",
529 "port": 5432
530 }
531 },
532 {
533 "name": "exampleMssql",
534 "connection_type": "mssql",
535 "connection": {
536 "user": "username",
537 "server": "localhost",
538 "database": "exampleDB",
539 "password": "yourPassword"
540 }
541 },
542 {
543 "name": "exampleSqlite",
544 "connection_type": "sqlite",
545 "connection": { "filename": "/path/to/your/sqlite/database.db" }
546 }
547 ]
548 }
549 }
550 ]
551}
552```
553
554Each connection should include a unique name, the `connection_type`, and the necessary connection parameters specific to each database type.
555
556Available connection types:
557
558- `postgres`
559- `mysql`
560- `sqlite`
561
562### @Google Context Provider – Reference Google Search Results
563
564Reference the results of a Google search.
565
566- YAML
567- JSON
568
569config.yaml
570
571```
572context:
573 - provider: google
574 params:
575 serperApiKey: <YOUR_SERPER.DEV_API_KEY>
576```
577
578config.json
579
580```json
581{
582 "contextProviders": [
583 {
584 "name": "google",
585 "params": { "serperApiKey": "<YOUR_SERPER.DEV_API_KEY>" }
586 }
587 ]
588}
589```
590
591For example, type "@Google python tutorial" if you want to search and discuss ways of learning Python.
592
593Note: You can get an API key for free at [serper.dev](https://serper.dev).
594
595### @Gitlab Merge Request Context Provider – Reference GitLab Merge Requests
596
597Reference an open MR for this branch on GitLab.
598
599- YAML
600- JSON
601
602config.yaml
603
604```
605context:
606 - provider: gitlab-mr
607 params:
608 token: "..."
609```
610
611config.json
612
613```json
614{ "contextProviders": [{ "name": "gitlab-mr", "params": { "token": "..." } }] }
615```
616
617You will need to create a [personal access token](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html) with the `read_api` scope.
618
619#### How to Use Self-Hosted GitLab
620
621You can specify the domain to communicate with by setting the `domain` parameter in your configurtion. By default this is set to `gitlab.com`.
622
623- YAML
624- JSON
625
626config.yaml
627
628```
629context:
630 - provider: gitlab-mr
631 params:
632 token: "..."
633 domain: "gitlab.example.com"
634```
635
636config.json
637
638```json
639{
640 "contextProviders": [
641 {
642 "name": "gitlab-mr",
643 "params": { "token": "...", "domain": "gitlab.example.com" }
644 }
645 ]
646}
647```
648
649#### How to Provide Context by Filtering Comments
650
651If 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`.
652
653### @Jira Context Provider – Reference Jira Issues
654
655Reference the conversation in a Jira issue.
656
657- YAML
658- JSON
659
660config.yaml
661
662```
663context:
664 - provider: jira
665 params:
666 domain: company.atlassian.net
667 token: ATATT...
668```
669
670config.json
671
672```json
673{
674 "contextProviders": [
675 {
676 "name": "jira",
677 "params": { "domain": "company.atlassian.net", "token": "ATATT..." }
678 }
679 ]
680}
681```
682
683Make 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.
684
685#### Jira Datacenter Support
686
687This 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.
688
689- YAML
690- JSON
691
692config.yaml
693
694```
695context:
696 - provider: jira
697 params:
698 apiVersion: "2"
699```
700
701config.json
702
703```json
704{ "contextProviders": [{ "name": "jira", "params": { "apiVersion": "2" } }] }
705```
706
707#### Issue Query
708
709By default, the following query will be used to find issues:
710
711```
712assignee = currentUser() AND resolution = Unresolved order by updated DESC
713```
714
715You can override this query by setting the `issueQuery` parameter.
716
717#### Max results
718
719You can set the `maxResults` parameter to limit the number of results returned. The default is `50`.
720
721### @Discord Context Provider – Reference Messages in Discord Channels
722
723Reference the messages in a Discord channel.
724
725- YAML
726- JSON
727
728config.yaml
729
730```
731context:
732 - provider: discord
733 params:
734 discordKey: "bot token"
735 guildId: "1234567890"
736 channels:
737 - id: "123456"
738 name: "example-channel"
739 - id: "678901"
740 name: "example-channel-2"
741```
742
743config.json
744
745```json
746{
747 "contextProviders": [
748 {
749 "name": "discord",
750 "params": {
751 "discordKey": "bot token",
752 "guildId": "1234567890",
753 "channels": [
754 { "id": "123456", "name": "example-channel" },
755 { "id": "678901", "name": "example-channel-2" }
756 ]
757 }
758 }
759 ]
760}
761```
762
763Make 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.
764
765### @HTTP Context Provider – Reference Data from an HTTP Request
766
767The 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.
768
769- YAML
770- JSON
771
772config.yaml
773
774```
775context:
776 - provider: http
777 params:
778 url: "https://api.example.com/v1/users"
779```
780
781config.json
782
783```json
784{
785 "contextProviders": [
786 { "name": "http", "params": { "url": "https://api.example.com/v1/users" } }
787 ]
788}
789```
790
791The receiving URL should expect to receive the following parameters:
792
793POST parameters
794
795```json
796{ query: string, fullInput: string}
797```
798
799The response 200 OK should be a JSON object with the following structure:
800
801Response
802
803```
804[ { "name": "", "description": "", "content": "" }]// OR{ "name": "", "description": "", "content": ""}
805```
806
807### @Commits Context Provider – Reference Git Commit Metadata and Diffs
808
809Reference specific git commit metadata and diff or all of the recent commits.
810
811- YAML
812- JSON
813
814config.yaml
815
816```
817context:
818 - provider: commit
819 params:
820 Depth: 50
821 LastXCommitsDepth: 10
822```
823
824config.json
825
826```json
827{
828 "contextProviders": [
829 { "name": "commit", "params": { "Depth": 50, "LastXCommitsDepth": 10 } }
830 ]
831}
832```
833
834The 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.
835
836### @Greptile Context Provider – Query Greptile Index of Repo/Branch
837
838Query a [Greptile](https://www.greptile.com/) index of the current repo/branch.
839
840- YAML
841- JSON
842
843config.yaml
844
845```
846context:
847 - provider: greptile
848 params:
849 greptileToken: "..."
850 githubToken: "..."
851```
852
853config.json
854
855```json
856{
857 "contextProviders": [
858 {
859 "name": "greptile",
860 "params": { "GreptileToken": "...", "GithubToken": "..." }
861 }
862 ]
863}
864```
865
866### How to Request a New Context Provider in Continue
867
868Not 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.