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
28 changes: 6 additions & 22 deletions britive_mcp_tools/tools/application_management_applications.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,16 @@ def application_management_applications_get(application_id: str):
)


@mcp.tool(name="application_management_applications_list", description="""Use this tool to retrieve a list of all applications available in the Britive tenant. This is typically the first step when identifying applications by name or filtering them based on user input. The results can be used to extract application IDs required for other tools.""")
@mcp.tool(
name="application_management_applications_list",
description="""Use this tool to retrieve a list of all applications available in the Britive tenant. This is typically the first step when identifying applications by name or filtering them based on user input. The results can be used to extract application IDs required for other tools.""",
)
def application_management_applications_list(extended: bool = True):
# This tool is generated using Britive SDK v4.3.0
"""Return a list of applications in the Britive tenant.

:param extended: if True, will return additional details of the applications
:return: List of applications."""
:param extended: if True, will return additional details of the applications
:return: List of applications."""

try:
client = client_wrapper.get_client()
Expand All @@ -64,22 +67,3 @@ def application_management_applications_list(extended: bool = True):
"User is not authenticated. Please ask the user to run `pybritive login` in their terminal to log in interactively. "
"After the user finishes logging in, ask them to confirm so you can retry this tool."
)


@mcp.tool(name="application_management_applications_get", description="""Use this tool to fetch detailed information about a specific application using its application ID. This includes metadata such as the application's nativeId, which is essential for querying permissions or identity associations in other tools.""")
def application_management_applications_get(application_id: str):
# This tool is generated using Britive SDK v4.3.0
"""Return details of the specified application

:param application_id: The ID of the application.
:return: Details of the application."""

try:
client = client_wrapper.get_client()
return client.application_management.applications.get(application_id)
except UnauthorizedRequest:
raise UnauthorizedRequest(
"User is not authenticated. Please ask the user to run `pybritive login` in their terminal to log in interactively. "
"After the user finishes logging in, ask them to confirm so you can retry this tool."
)

69 changes: 0 additions & 69 deletions britive_mcp_tools/tools/audit_logs_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,72 +86,3 @@ def audit_logs_logs_query(
"User is not authenticated. Please ask the user to run `pybritive login` in their terminal to log in interactively. "
"After the user finishes logging in, ask them to confirm so you can retry this tool."
)


@mcp.tool(name="audit_logs_logs_fields", description="""Call this before using query tool as it returns list of fields that can be used in a filter for an audit query.""")
def audit_logs_logs_fields():
# This tool is generated using Britive SDK v4.3.0
"""Return list of fields that be can used in a filter for an audit query.

:return: Dict of field keys to field names."""

try:
client = client_wrapper.get_client()
return client.audit_logs.logs.fields()
except UnauthorizedRequest:
raise UnauthorizedRequest(
"User is not authenticated. Please ask the user to run `pybritive login` in their terminal to log in interactively. "
"After the user finishes logging in, ask them to confirm so you can retry this tool."
)


@mcp.tool(name="audit_logs_logs_operators", description="""Call this before using query tool as it returns the list of operators that can be used in a filter for an audit query.""")
def audit_logs_logs_operators():
# This tool is generated using Britive SDK v4.3.0
"""Return the list of operators that can be used in a filter for an audit query.

:return: Dict of operator keys to operator names."""

try:
client = client_wrapper.get_client()
return client.audit_logs.logs.operators()
except UnauthorizedRequest:
raise UnauthorizedRequest(
"User is not authenticated. Please ask the user to run `pybritive login` in their terminal to log in interactively. "
"After the user finishes logging in, ask them to confirm so you can retry this tool."
)


@mcp.tool(name="audit_logs_logs_query", description="""This is used to retrieve audit log events based on the fields and operators. You need to call the `fields` and `operators` tools before using this tool to ensure you have the correct fields and operators for your query.""")
def audit_logs_logs_query(from_time: datetime.datetime = None, to_time: datetime.datetime = None, filter_expression: str = None, csv: bool = False):
# This tool is generated using Britive SDK v4.3.0
"""Retrieve audit log events.

`csv` options:

- True: A CSV string is returned. The caller must persist the CSV string to disk.
- False: A python list of audit events is returned.

:param from_time: Lower end of the time frame to search. If not provided will default to
7 days before `to_time`. `from_time` will be interpreted as if in UTC timezone so it is up to the caller to
ensure that the datetime object represents UTC. No timezone manipulation will occur.
:param to_time: Upper end of the time frame to search. If not provided will default to
`datetime.datetime.utcnow()`. `to_time` will be interpreted as if in UTC timezone so it is up to the caller
to ensure that the datetime object represents UTC. No timezone manipulation will occur.
:param filter_expression: The expression used to filter the results. A list of available fields and operators
can be found using `britive.audit_logs.logs.fields` and `britive.audit_logs.logs.operators`, respectively.
Multiple filter expressions must be joined together by `and`. No other join operator is support.
Example: actor.displayName co "bob" and event.displayName eq "application"
:param csv: Will result in a CSV string of the audit events being returned instead of a python list of events.
:return: Either python list of events (dicts) or CSV string.
:raises: ValueError - If from_time is greater than to_time."""

try:
client = client_wrapper.get_client()
return client.audit_logs.logs.query(from_time, to_time, filter_expression, csv)
except UnauthorizedRequest:
raise UnauthorizedRequest(
"User is not authenticated. Please ask the user to run `pybritive login` in their terminal to log in interactively. "
"After the user finishes logging in, ask them to confirm so you can retry this tool."
)

104 changes: 0 additions & 104 deletions britive_mcp_tools/tools/identity_management_service_identities.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,107 +134,3 @@ def identity_management_service_identities_disable(
"User is not authenticated. Please ask the user to run `pybritive login` in their terminal to log in interactively. "
"After the user finishes logging in, ask them to confirm so you can retry this tool."
)


@mcp.tool(name="identity_management_service_identities_list", description="""Use this tool **only if the user has confirmed they are referring to service identities**. Do not assume the type of identity.This tool lists all service identities available in the Britive platform. It provides list of details such as identity ID, name, type, and status. Use this tool to get userId based on filter options and use this id in further operations like enabling or disabling a service identity. You can filter the list by name, type, status, and tags to narrow down the results.""")
def identity_management_service_identities_list(filter_expression: str = None, include_tags: bool = False):
# This tool is generated using Britive SDK v4.3.0
"""Provide an optionally filtered list of all service identities.

:param filter_expression: filter list of users based on name, status, or role. The supported operators
are 'eq' and 'co'. Example: 'name co "Smith"'
:param include_tags: if this is set to true, tags/group memberships are returned.
:return: List of service identity records"""

try:
client = client_wrapper.get_client()
return client.identity_management.service_identities.list(filter_expression, include_tags)
except UnauthorizedRequest:
raise UnauthorizedRequest(
"User is not authenticated. Please ask the user to run `pybritive login` in their terminal to log in interactively. "
"After the user finishes logging in, ask them to confirm so you can retry this tool."
)


@mcp.tool(name="identity_management_service_identities_get", description="""Use this tool **only if the user has confirmed they are referring to service identities**. Do not assume the type of identity.This tool retrieves detailed information about a specific service identity by its ID. It provides comprehensive details including the identity's name, type, status, created date, modified date, last login, token expires on, token expiration in days, type of serviceIdentity type and any associated tags. Use this tool to gather specific information about a service identity before taking actions like enabling or disabling it.""")
def identity_management_service_identities_get(service_identity_id: str):
# This tool is generated using Britive SDK v4.3.0
"""Provide details of the given service_identity.

:param service_identity_id: The ID of the service identity.
:return: Details of the specified user."""

try:
client = client_wrapper.get_client()
return client.identity_management.service_identities.get(service_identity_id)
except UnauthorizedRequest:
raise UnauthorizedRequest(
"User is not authenticated. Please ask the user to run `pybritive login` in their terminal to log in interactively. "
"After the user finishes logging in, ask them to confirm so you can retry this tool."
)


@mcp.tool(name="identity_management_service_identities_search", description="""Use this tool **only if the user has confirmed they are referring to service identities**. Do not assume the type of identity.This tool searches for service identities based on a query string. It allows you to find identities by name, type, or other attributes. The search results include basic details such as identity ID, name, type, and status. Use this tool to quickly locate service identities that match specific criteria without needing to list all identities.""")
def identity_management_service_identities_search(search_string: str):
# This tool is generated using Britive SDK v4.3.0
"""Search all user fields for the given `search_string` and returns
a list of matched service identities.

:param search_string:
:return: List of user records"""

try:
client = client_wrapper.get_client()
return client.identity_management.service_identities.search(search_string)
except UnauthorizedRequest:
raise UnauthorizedRequest(
"User is not authenticated. Please ask the user to run `pybritive login` in their terminal to log in interactively. "
"After the user finishes logging in, ask them to confirm so you can retry this tool."
)


@mcp.tool(name="identity_management_service_identities_enable", description="""Use this tool **only if the user has confirmed they are referring to service identities**. Do not assume the type of identity.Checks the status of the specified service identity. If the status is inactive, prompts the user for confirmation to enable it. If confirmed, it performs the enable action. If the identity is already active, it informs the user and suggests disabling it instead.""")
def identity_management_service_identities_enable(service_identity_id: str = None, service_identity_ids: list = None):
# This tool is generated using Britive SDK v4.3.0
"""Enable the given service identities.

You can pass in both `service_identity_id` for a single user and `service_identity_ids` to enable multiple
service identities in one call. If both `service_identity_id` and `service_identity_ids` are provided they
will be merged together into one list.

:param service_identity_id: The ID of the user you wish to enable.
:param service_identity_ids: A list of user IDs that you wish to enable.
:return: if `service_identity_ids` is set will return a list of user records, else returns a user dict"""

try:
client = client_wrapper.get_client()
return client.identity_management.service_identities.enable(service_identity_id, service_identity_ids)
except UnauthorizedRequest:
raise UnauthorizedRequest(
"User is not authenticated. Please ask the user to run `pybritive login` in their terminal to log in interactively. "
"After the user finishes logging in, ask them to confirm so you can retry this tool."
)


@mcp.tool(name="identity_management_service_identities_disable", description="""Use this tool **only if the user has confirmed they are referring to service identities**. Do not assume the type of identity.Checks the status of the specified service identity. If the status is active, prompts the user for confirmation to disable it. If confirmed, it performs the disable action. If the identity is already inactive, it informs the user and suggests enabling it instead.""")
def identity_management_service_identities_disable(service_identity_id: str = None, service_identity_ids: list = None):
# This tool is generated using Britive SDK v4.3.0
"""Disable the given service identities.

You can pass in both `service_identity_id` for a single service identity and `service_identity_ids` to disable
multiple service identitie at in one call. If both `service_identity_id` and `service_identity_ids` are
provided they will be merged together into one list.

:param service_identity_id: The ID of the user you wish to disable.
:param service_identity_ids: A list of user IDs that you wish to disable.
:return: if `user_ids` is set will return a list of user records, else returns a user dict"""

try:
client = client_wrapper.get_client()
return client.identity_management.service_identities.disable(service_identity_id, service_identity_ids)
except UnauthorizedRequest:
raise UnauthorizedRequest(
"User is not authenticated. Please ask the user to run `pybritive login` in their terminal to log in interactively. "
"After the user finishes logging in, ask them to confirm so you can retry this tool."
)

Loading