mirror of
https://github.com/dnlbauer/cordra-mcp.git
synced 2026-09-11 14:15:31 +00:00
feat: add design object resource for repository configuration access
Add new MCP resource cordra://design to retrieve Cordra's central design object containing repository configuration, type definitions, and system settings. - Add CordraClient.get_design() method using /api/objects/design endpoint - Add get_cordra_design() resource handler with proper MCP annotations - Include comprehensive error handling for authentication failures - Document administrative privilege requirements in descriptions - Add complete test coverage for both client and server functionality The design object provides AI systems access to understand the complete data model and configuration structure of a Cordra repository.
This commit is contained in:
@@ -105,6 +105,39 @@ async def get_cordra_object(prefix: str, suffix: str) -> str:
|
||||
raise RuntimeError(f"Failed to retrieve object {object_id}: {e}") from e
|
||||
|
||||
|
||||
@mcp.resource(
|
||||
"cordra://design",
|
||||
name="cordra-design",
|
||||
title="Retrieve Cordra Design Object",
|
||||
description="Retrieve the Cordra design object containing repository configuration. Administrative privileges are typically required to access this object.",
|
||||
mime_type="application/json",
|
||||
)
|
||||
async def get_cordra_design() -> str:
|
||||
"""Retrieve the Cordra design object containing repository configuration.
|
||||
|
||||
The design object is the central location where Cordra stores its configuration,
|
||||
including type definitions, workflow configurations, and system settings.
|
||||
Administrative privileges are typically required to access this object.
|
||||
|
||||
Returns:
|
||||
JSON representation of the design object
|
||||
|
||||
Raises:
|
||||
RuntimeError: If the design object is not found, authentication fails, or there's an API error
|
||||
"""
|
||||
try:
|
||||
design_object = await cordra_client.get_design()
|
||||
object_dict = design_object.model_dump()
|
||||
return json.dumps(object_dict, indent=2)
|
||||
|
||||
except CordraNotFoundError as e:
|
||||
raise RuntimeError("Design object not found") from e
|
||||
except CordraAuthenticationError as e:
|
||||
raise RuntimeError(f"Authentication failed: {e}") from e
|
||||
except CordraClientError as e:
|
||||
raise RuntimeError(f"Failed to retrieve design object: {e}") from e
|
||||
|
||||
|
||||
async def create_schema_resource(schema_name: str) -> str:
|
||||
"""Create content for a specific schema resource."""
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user