thing
This commit is contained in:
@@ -63,3 +63,15 @@ class CapabilitySource:
|
||||
"prompt_count": len(self.capabilities.prompts),
|
||||
"resource_count": len(self.capabilities.resources),
|
||||
}
|
||||
|
||||
def as_inventory(self) -> dict[str, Any]:
|
||||
"""Return source metadata plus the capability names it owns."""
|
||||
return {
|
||||
**self.as_status(),
|
||||
"capabilities": {
|
||||
"tools": sorted(self.capabilities.tools),
|
||||
"node_specs": sorted(self.capabilities.node_specs),
|
||||
"prompts": sorted(self.capabilities.prompts),
|
||||
"resources": sorted(self.capabilities.resources),
|
||||
},
|
||||
}
|
||||
|
||||
@@ -250,6 +250,16 @@ class WfMcpService:
|
||||
and source.visibility.planner
|
||||
]
|
||||
|
||||
def list_sources(self) -> list[dict[str, Any]]:
|
||||
"""Return every capability source with the names it currently owns."""
|
||||
return [
|
||||
source.as_inventory()
|
||||
for source in sorted(
|
||||
self.capability_sources.values(),
|
||||
key=lambda source: source.id,
|
||||
)
|
||||
]
|
||||
|
||||
def list_available_specs(self) -> list[CatalogNodeEntry]:
|
||||
"""Return planner-visible node catalog entries from every visible source."""
|
||||
return self.get_planner_catalog().entries()
|
||||
|
||||
@@ -39,6 +39,10 @@ def register_broker_tools(server: FastMCP, service: WfMcpService) -> None:
|
||||
async def list_spec_sources() -> list[dict[str, Any]]:
|
||||
return handlers.list_spec_sources()
|
||||
|
||||
@server.tool()
|
||||
async def list_sources() -> list[dict[str, Any]]:
|
||||
return handlers.list_sources()
|
||||
|
||||
@server.tool()
|
||||
async def read_broker_resource(qualified_name: str) -> dict[str, Any]:
|
||||
return await handlers.read_broker_resource(qualified_name)
|
||||
|
||||
Reference in New Issue
Block a user