MCPcopy Create free account
hub / github.com/ReversecLabs/C3 / GetChannelCapability

Function GetChannelCapability

Src/ChannelLinter/ChannelLinter.cpp:40–57  ·  view source on GitHub ↗

Get Channel capability supplemented with build-in capability @param channel metadata @returns Channel capability supplemented with build-in capability

Source from the content-addressed store, hash-verified

38 /// @param channel metadata
39 /// @returns Channel capability supplemented with build-in capability
40 auto GetChannelCapability(InterfaceFactory::InterfaceData<AbstractChannel> const& channelInfo)
41 {
42 try
43 {
44 auto ret = json::parse(channelInfo.m_Capability);
45 if(!ret.contains("create"))
46 {
47 std::cout << "[Warning] create property does not exist, generating default one." << std::endl;
48 C3::Core::Profiler::Gateway::EnsureCreateExists(ret);
49 }
50 C3::Core::Profiler::Gateway::AddBuildInCommands(ret, true);
51 return ret;
52 }
53 catch (json::parse_error& e)
54 {
55 throw std::runtime_error("Failed to parse channel's capability json. "s + e.what());
56 }
57 }
58
59 /// Get command id from string (allows negative inputs e.g "-2" for Close)
60 /// @param command Id string

Callers 1

ChannelLinterMethod · 0.85

Calls 3

parseFunction · 0.85
containsMethod · 0.80
whatMethod · 0.45

Tested by

no test coverage detected