context69_contracts/
mcp.rs1use chrono::{DateTime, Utc};
2use schemars::JsonSchema;
3use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
6pub struct McpDocumentArgs {
7 pub document_id: i64,
8 #[serde(default, skip_serializing_if = "Option::is_none")]
9 pub locale: Option<String>,
10 #[serde(default)]
11 pub chunk_cursor: Option<String>,
12 #[serde(default = "default_chunk_limit")]
13 pub chunk_limit: usize,
14}
15
16#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
17pub struct McpSearchHit {
18 pub document_id: i64,
19 pub external_id: String,
20 pub title: String,
21 pub summary: Option<String>,
22 pub source_uri: String,
23 pub published_at: Option<DateTime<Utc>>,
24 pub score: f32,
25 pub snippet: String,
26}
27
28#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
29pub struct McpSearchResponse {
30 pub query: String,
31 pub hits: Vec<McpSearchHit>,
32 pub truncated: bool,
33 pub has_more: bool,
34}
35
36#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
37pub struct McpDocumentSummary {
38 pub document_id: i64,
39 pub external_id: String,
40 pub title: String,
41 pub summary: Option<String>,
42 pub source_uri: String,
43 pub published_at: Option<DateTime<Utc>>,
44 pub updated_at: DateTime<Utc>,
45}
46
47#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
48pub struct McpDocumentQueryResponse {
49 pub documents: Vec<McpDocumentSummary>,
50 pub next_cursor: Option<String>,
51 pub truncated: bool,
52 pub has_more: bool,
53}
54
55#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
56pub struct McpDocumentDetailResponse {
57 pub document: crate::DocumentResponse,
58 pub next_chunk_cursor: Option<String>,
59 pub has_more: bool,
60 pub truncated: bool,
61}
62
63#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
64pub struct McpBatchDocumentArgs {
65 pub group_path: String,
66 pub request: crate::BatchGetDocumentsRequest,
67}
68
69#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
70pub struct McpBatchDocumentResponse {
71 pub items: Vec<McpBatchDocumentItem>,
72 pub truncated: bool,
73 pub has_more: bool,
74}
75
76#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
77pub struct McpSourceListResponse {
78 pub sources: Vec<crate::SourceStatus>,
79 pub truncated: bool,
80 pub has_more: bool,
81}
82
83#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
84pub struct McpBatchDocumentItem {
85 pub key: crate::DocumentKey,
86 pub document: Option<McpDocumentDetailResponse>,
87}
88
89fn default_chunk_limit() -> usize {
90 20
91}