Skip to main content

vtcode_webmcp/remote_mcp/
types.rs

1use std::collections::BTreeMap;
2
3use serde::{Deserialize, Serialize};
4use serde_json::Value;
5
6/// Input accepted by the OpenAI-compatible `search` tool.
7#[derive(Debug, Clone, Default, Deserialize, schemars::JsonSchema)]
8pub struct SearchInput {
9    /// Case-insensitive substring to find in visible workspace paths or content.
10    pub query: String,
11}
12
13/// Input accepted by the OpenAI-compatible `fetch` tool.
14#[derive(Debug, Clone, Default, Deserialize, schemars::JsonSchema)]
15pub struct FetchInput {
16    /// Workspace-relative file ID returned by `search`.
17    pub id: String,
18}
19
20/// A search result compatible with the OpenAI remote MCP contract.
21#[derive(Debug, Clone, Serialize, schemars::JsonSchema, PartialEq, Eq)]
22pub struct SearchResult {
23    /// Stable workspace-relative file ID.
24    pub id: String,
25    /// Human-readable result title.
26    pub title: String,
27    /// Citation URL, or an empty string when no prefix is configured.
28    pub url: String,
29}
30
31/// The structured result returned by `search`.
32#[derive(Debug, Clone, Serialize, schemars::JsonSchema, PartialEq, Eq)]
33pub struct SearchOutput {
34    /// Matching visible workspace files.
35    pub results: Vec<SearchResult>,
36}
37
38/// The structured result returned by `fetch`.
39#[derive(Debug, Clone, Serialize, schemars::JsonSchema, PartialEq)]
40pub struct FetchOutput {
41    /// Workspace-relative file ID.
42    pub id: String,
43    /// Human-readable document title.
44    pub title: String,
45    /// UTF-8 file contents.
46    pub text: String,
47    /// Citation URL, or an empty string when no prefix is configured.
48    pub url: String,
49    /// Optional provider-defined metadata. VT Code currently has none.
50    #[serde(skip_serializing_if = "Option::is_none")]
51    pub metadata: Option<BTreeMap<String, Value>>,
52}