Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,12 @@ impl ApiEndpoint {
metadata: MessageField::from_option(self.metadata.as_ref().map(|m| {
infrastructure_map::Metadata {
description: m.description.clone().unwrap_or_default(),
source: MessageField::from_option(m.source.as_ref().map(|s| {
infrastructure_map::SourceLocation {
file: s.file.clone(),
special_fields: Default::default(),
}
})),
special_fields: Default::default(),
}
})),
Expand All @@ -157,6 +163,10 @@ impl ApiEndpoint {
} else {
Some(m.description)
},
source: m
.source
.into_option()
.map(|s| super::table::SourceLocation { file: s.file }),
}),
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,12 @@ impl FunctionProcess {
metadata: MessageField::from_option(self.metadata.as_ref().map(|m| {
crate::proto::infrastructure_map::Metadata {
description: m.description.clone().unwrap_or_default(),
source: MessageField::from_option(m.source.as_ref().map(|s| {
crate::proto::infrastructure_map::SourceLocation {
file: s.file.clone(),
special_fields: Default::default(),
}
})),
special_fields: Default::default(),
}
})),
Expand All @@ -159,6 +165,10 @@ impl FunctionProcess {
} else {
Some(m.description)
},
source: m
.source
.into_option()
.map(|s| super::table::SourceLocation { file: s.file }),
}),
}
}
Expand Down
17 changes: 17 additions & 0 deletions apps/framework-cli/src/framework/core/infrastructure/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,16 @@ use serde_json::Value;
use std::fmt;
use std::fmt::Debug;

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Eq, Hash)]
pub struct SourceLocation {
pub file: String,
}

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Eq, Hash)]
pub struct Metadata {
pub description: Option<String>,
#[serde(skip_serializing_if = "Option::is_none", default)]
pub source: Option<SourceLocation>,
}

/// Prefix for Moose-managed metadata in column comments.
Expand Down Expand Up @@ -197,6 +204,12 @@ impl Table {
metadata: MessageField::from_option(self.metadata.as_ref().map(|m| {
infrastructure_map::Metadata {
description: m.description.clone().unwrap_or_default(),
source: MessageField::from_option(m.source.as_ref().map(|s| {
infrastructure_map::SourceLocation {
file: s.file.clone(),
special_fields: Default::default(),
}
})),
special_fields: Default::default(),
}
})),
Expand Down Expand Up @@ -241,6 +254,10 @@ impl Table {
} else {
Some(m.description)
},
source: m
.source
.into_option()
.map(|s| SourceLocation { file: s.file }),
}),
life_cycle: match proto.life_cycle.enum_value_or_default() {
ProtoLifeCycle::FULLY_MANAGED => LifeCycle::FullyManaged,
Expand Down
10 changes: 10 additions & 0 deletions apps/framework-cli/src/framework/core/infrastructure/topic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,12 @@ impl Topic {
metadata: MessageField::from_option(self.metadata.as_ref().map(|m| {
proto::infrastructure_map::Metadata {
description: m.description.clone().unwrap_or_default(),
source: MessageField::from_option(m.source.as_ref().map(|s| {
proto::infrastructure_map::SourceLocation {
file: s.file.clone(),
special_fields: Default::default(),
}
})),
special_fields: Default::default(),
}
})),
Expand Down Expand Up @@ -181,6 +187,10 @@ impl Topic {
} else {
Some(m.description)
},
source: m
.source
.into_option()
.map(|s| super::table::SourceLocation { file: s.file }),
}),
life_cycle: match proto.life_cycle.enum_value_or_default() {
ProtoLifeCycle::FULLY_MANAGED => LifeCycle::FullyManaged,
Expand Down
13 changes: 11 additions & 2 deletions apps/framework-cli/src/mcp/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use rmcp::{
};
use std::sync::Arc;

use super::tools::{create_error_result, infra_map, logs};
use super::tools::{create_error_result, get_source, infra_map, logs};
use crate::infrastructure::redis::redis_client::RedisClient;

/// Handler for the MCP server that implements the Model Context Protocol
Expand Down Expand Up @@ -66,7 +66,11 @@ impl ServerHandler for MooseMcpHandler {
_context: RequestContext<RoleServer>,
) -> Result<ListToolsResult, ErrorData> {
Ok(ListToolsResult {
tools: vec![logs::tool_definition(), infra_map::tool_definition()],
tools: vec![
logs::tool_definition(),
infra_map::tool_definition(),
get_source::tool_definition(),
],
next_cursor: None,
})
}
Expand All @@ -83,6 +87,11 @@ impl ServerHandler for MooseMcpHandler {
self.redis_client.clone(),
)
.await),
"get_source" => Ok(get_source::handle_call(
param.arguments.as_ref(),
self.redis_client.clone(),
)
.await),
_ => Ok(create_error_result(format!("Unknown tool: {}", param.name))),
}
}
Expand Down
Loading
Loading