Skip to content

Commit 9635a2e

Browse files
rennercbbayburt
authored andcommitted
Improve docstring return type descriptions
1 parent cbfbd56 commit 9635a2e

File tree

1 file changed

+51
-12
lines changed

1 file changed

+51
-12
lines changed

src/mcp_server_uyuni/server.py

Lines changed: 51 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1556,10 +1556,28 @@ async def list_system_groups(ctx: Context) -> List[Dict[str, str]]:
15561556
each group the identifier, name, description and system count.
15571557
15581558
Returns:
1559-
List[Dict[str, str]]: A list of dictionaries, where each dictionary represents a system group with 'id',
1560-
'name', 'description' and 'system_count' fields. The 'system_count' refers to the
1561-
number of systems assigned to each group. Returns an empty list if the API call
1562-
fails, the response is not in the expected format, or no groups are found.
1559+
A list of dictionaries, where each dictionary represents a system group with 'id', 'name',
1560+
'description' and 'system_count' fields. The 'system_count' refers to the number of systems
1561+
assigned to each group.
1562+
1563+
Returns an empty list if the API call fails, the response is not in the expected format,
1564+
or no groups are found.
1565+
1566+
Example:
1567+
[
1568+
{
1569+
"id": "1",
1570+
"name": "Default Group",
1571+
"description": "Default group for all systems",
1572+
"system_count": "10"
1573+
},
1574+
{
1575+
"id": "2",
1576+
"name": "Test Group",
1577+
"description": "Group for testing purposes",
1578+
"system_count": "5"
1579+
}
1580+
]
15631581
"""
15641582
list_groups_path = '/rhn/manager/api/systemgroup/listAllGroups'
15651583

@@ -1599,9 +1617,11 @@ async def create_system_group(name: str, ctx: Context, description: str = "", co
15991617
a second time with `confirm=True`.
16001618
16011619
Returns:
1602-
str: A success message if the group was created,
1603-
e.g., "Successfully created system group 'my-group'".
1604-
Returns an error message if the creation failed.
1620+
A success message if the group was created, e.g., "Successfully created system group 'my-group'".
1621+
Returns an error message if the creation failed.
1622+
1623+
Example:
1624+
Successfully created system group 'my-group'.
16051625
"""
16061626
log_string = f"Creating system group '{name}'"
16071627
logger.info(log_string)
@@ -1645,9 +1665,22 @@ async def list_group_systems(group_name: str, ctx: Context) -> List[Dict[str, An
16451665
group_name: The name of the system group.
16461666
16471667
Returns:
1648-
List[Dict[str, Any]]: A list of dictionaries, where each dictionary represents a system
1649-
with 'system_id' and 'system_name' fields.
1650-
Returns an empty list if the API call fails or no systems are found.
1668+
A list of dictionaries, where each dictionary represents a system with 'system_id' and
1669+
'system_name' fields.
1670+
1671+
Returns an empty list if the API call fails or no systems are found.
1672+
1673+
Example:
1674+
[
1675+
{
1676+
"system_id": "123456789",
1677+
"system_name": "my-system"
1678+
},
1679+
{
1680+
"system_id": "987654321",
1681+
"system_name": "my-other-system"
1682+
}
1683+
]
16511684
"""
16521685
log_string = f"Listing systems in group '{group_name}'"
16531686
logger.info(log_string)
@@ -1694,7 +1727,10 @@ async def add_systems_to_group(group_name: str, system_identifiers: List[Union[s
16941727
a second time with `confirm=True`.
16951728
16961729
Returns:
1697-
str: A success message if the systems were added.
1730+
A success message if the systems were added.
1731+
1732+
Example:
1733+
Successfully added 1 systems to/from group 'test-group'.
16981734
"""
16991735
return await _manage_group_systems(group_name, system_identifiers, True, ctx, confirm)
17001736

@@ -1713,7 +1749,10 @@ async def remove_systems_from_group(group_name: str, system_identifiers: List[Un
17131749
a second time with `confirm=True`.
17141750
17151751
Returns:
1716-
str: A success message if the systems were removed.
1752+
A success message if the systems were removed.
1753+
1754+
Example:
1755+
Successfully removed 1 systems to/from group 'test-group'.
17171756
"""
17181757
return await _manage_group_systems(group_name, system_identifiers, False, ctx, confirm)
17191758

0 commit comments

Comments
 (0)