Skip to content

Commit d25fd15

Browse files
sqsbevzzz
authored andcommitted
document mentions API in protocol spec page (#132)
1 parent 880ca8a commit d25fd15

File tree

1 file changed

+57
-6
lines changed

1 file changed

+57
-6
lines changed

web/content/docs/protocol.mdx

Lines changed: 57 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ Providers are stateless.
2626
Providers implement the following API methods:
2727

2828
- [Meta](#meta): report the provider's name, features, and other metadata (required)
29-
- [Items](#items): search for documents and other content from the provider
29+
- [Mentions](#mentions): search for @-mentionable items
30+
- [Items](#items): fetch documents and other content from the provider
3031
- [Annotations](#annotations): get annotations for a code file
3132

3233
### Meta
@@ -76,18 +77,68 @@ interface Selector {
7677
}
7778
```
7879

80+
### Mentions
81+
82+
The mentions request is sent by the client to the provider to search for @-mentionable items in the resource.
83+
84+
**Request:** `{ method: "mentions", params: MentionsParams, settings?: object }`
85+
86+
```typescript
87+
export interface MentionsParams {
88+
/**
89+
* A search query that is interpreted by providers to filter the items in the result set.
90+
*/
91+
query?: string
92+
}
93+
```
94+
95+
**Response:** `{ result: MentionsResult }` or `{ error: { code, integer, data? } }`
96+
97+
```typescript
98+
type MentionsResult = Mention[]
99+
100+
/**
101+
* A mention contains presentation information relevant to a resource.
102+
*/
103+
export interface Mention {
104+
/**
105+
* A descriptive title.
106+
*/
107+
title: string
108+
109+
/**
110+
* An item description.
111+
*/
112+
description?: string
113+
114+
/**
115+
* A URI for the mention item.
116+
*/
117+
uri: string
118+
119+
data?: {
120+
[k: string]: unknown | undefined
121+
}
122+
}
123+
```
124+
79125
### Items
80126

81-
The items request is sent by the client to the provider to fetch a list of items for a resource.
127+
The items request is sent by the client to the provider to fetch items from a resource.
82128

83129
**Request:** `{ method: "items", params: ItemsParams, settings?: object }`
84130

85131
```typescript
86132
interface ItemsParams {
87-
/**
88-
* A search query that is interpreted by providers to filter the items in the result set.
89-
*/
90-
query?: string
133+
/**
134+
* A message that is interpreted by providers to return relevant items.
135+
*/
136+
message?: string
137+
138+
/**
139+
* A mention interpreted by providers to return items for the specified mention.
140+
*/
141+
mention?: Mention
91142
}
92143
```
93144

0 commit comments

Comments
 (0)