Skip to main content

harn_vm/mcp_server/
defs.rs

1use crate::value::VmClosure;
2
3/// A tool extracted from a Harn tool_registry, ready to serve over MCP.
4pub struct McpToolDef {
5    pub name: String,
6    pub title: Option<String>,
7    pub description: String,
8    pub input_schema: serde_json::Value,
9    pub output_schema: Option<serde_json::Value>,
10    pub annotations: Option<serde_json::Value>,
11    pub handler: VmClosure,
12}
13
14/// A static resource to serve over MCP.
15pub struct McpResourceDef {
16    pub uri: String,
17    pub name: String,
18    pub title: Option<String>,
19    pub description: Option<String>,
20    pub mime_type: Option<String>,
21    pub text: String,
22}
23
24/// A parameterized resource template (RFC 6570 URI template).
25pub struct McpResourceTemplateDef {
26    pub uri_template: String,
27    pub name: String,
28    pub title: Option<String>,
29    pub description: Option<String>,
30    pub mime_type: Option<String>,
31    pub handler: VmClosure,
32}
33
34/// A prompt argument definition.
35pub struct McpPromptArgDef {
36    pub name: String,
37    pub description: Option<String>,
38    pub required: bool,
39}
40
41/// A prompt template to serve over MCP.
42pub struct McpPromptDef {
43    pub name: String,
44    pub title: Option<String>,
45    pub description: Option<String>,
46    pub arguments: Option<Vec<McpPromptArgDef>>,
47    pub handler: VmClosure,
48}