Skip to content

API Reference parrot_tools.navigator.toolkit

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot_tools.navigator.toolkit

View source

NavigatorToolkit for AI-Parrot - Manage Navigator Programs, Modules, Dashboards & Widgets.

This toolkit provides tools for:

  • Creating and updating Programs (auth.programs)
  • Creating and updating Modules with menu hierarchy (navigator.modules)
  • Creating, updating, and cloning Dashboards (navigator.dashboards)
  • Creating and updating Widgets with template inheritance (navigator.widgets)
  • Managing permissions (client_modules, modules_groups, program_clients, program_groups)
  • Listing widget types, categories, clients, and groups
  • Searching across all Navigator entities
  • Retrieving full program structure (program → modules → dashboards → widgets)

Refactored (FEAT-106 / TASK-744): inherits PostgresToolkit instead of AbstractToolkit. DB plumbing delegated to parent (asyncdb pool via _acquire_asyncdb_connection).

Alias AssignModuleClientInput

Re-exported from parrot_tools.navigator.schemas.AssignModuleClientInput.

Alias AssignModuleGroupInput

Re-exported from parrot_tools.navigator.schemas.AssignModuleGroupInput.

Alias CloneDashboardInput

Re-exported from parrot_tools.navigator.schemas.CloneDashboardInput.

Alias DashboardCreateInput

Re-exported from parrot_tools.navigator.schemas.DashboardCreateInput.

Alias DashboardUpdateInput

Re-exported from parrot_tools.navigator.schemas.DashboardUpdateInput.

Alias EntityLookupInput

Re-exported from parrot_tools.navigator.schemas.EntityLookupInput.

Alias ExecuteSqlInput

Re-exported from parrot_tools.navigator.schemas.ExecuteSqlInput.

Alias ModuleCreateInput

Re-exported from parrot_tools.navigator.schemas.ModuleCreateInput.

Alias ModuleUpdateInput

Re-exported from parrot_tools.navigator.schemas.ModuleUpdateInput.

Class NavigatorToolkit

Toolkit for managing the Navigator platform.

Provides tools for full lifecycle management of Programs, Modules, Dashboards and Widgets, including permissions and search.

Inherits PostgresToolkit (FEAT-106) — DB connection managed by parent via asyncdb pool. All write tools require read_only=False (default for NavigatorToolkit: always False).

Example usage::

toolkit = NavigatorToolkit(dsn="postgres://user:pw@host/db")
tools = toolkit.get_tools()  # nav_create_program, nav_get_program, …

# Skip all dry-run gates (e.g. in an automated pipeline):
toolkit = NavigatorToolkit(dsn="...", confirm_execution=True)
Parameter Type Default Description
dsn str ''
default_client_id int 1
user_id Optional[int] None
confirm_execution bool False When True, all write tools skip the dry-run confirmation step and execute immediately. Useful for scripted or trusted contexts where human-in-the-loop approval is handled externally. Defaults to False (safe, interactive mode).
page_index Optional[Any] None
builder_groups Optional[List[str]] None
**kwargs Any {}

Attributes:

Attribute Type Description
tool_prefix str

Method NavigatorToolkit.stop

Close the underlying DB connection and clear permissions cache.

stop() -> None

Method NavigatorToolkit.execute_sql

Execute a raw SQL statement (DDL or DML).

Use for CREATE SCHEMA, CREATE TABLE, and other DDL operations that cannot be expressed through the Navigator CRUD tools. DDL statements (CREATE, ALTER, DROP) return None on success — that is normal. For queries that return rows (SELECT or INSERT … RETURNING), pass returning=True.

execute_sql(sql: str, params: tuple = (), conn: Optional[Any] = None, returning: bool = False, single_row: bool = False) -> Any

Parameter Type Default Description
sql str
params tuple ()
conn Optional[Any] None
returning bool False
single_row bool False

Returns: Any

Method NavigatorToolkit.create_program

Create a new Navigator program with client and group assignments.

Clients can be specified by IDs or slugs (e.g., 'navigator_new', 'navigator_dev'). Group ID 1 (superuser) is always included automatically. Requires superuser access.

create_program(program_name: str, program_slug: str, description: Optional[str] = None, abbrv: Optional[str] = None, is_active: bool = True, attributes: Optional[Dict[str, Any]] = None, image_url: Optional[str] = None, visible: Optional[bool] = True, allow_filtering: Optional[bool] = None, filtering_show: Optional[Dict[str, Any]] = None, conditions: Optional[Dict[str, Any]] = None, client_ids: Optional[List[int]] = None, client_slugs: Optional[List[str]] = None, group_ids: List[int] = None, confirm_execution: bool = False) -> Dict[str, Any]

Parameter Type Default Description
program_name str
program_slug str
description Optional[str] None
abbrv Optional[str] None
is_active bool True
attributes Optional[Dict[str, Any]] None
image_url Optional[str] None
visible Optional[bool] True
allow_filtering Optional[bool] None
filtering_show Optional[Dict[str, Any]] None
conditions Optional[Dict[str, Any]] None
client_ids Optional[List[int]] None
client_slugs Optional[List[str]] None
group_ids List[int] None
confirm_execution bool False

Returns: Dict[str, Any]

Method NavigatorToolkit.update_program

Update an existing Navigator program. Only provided fields are changed. Requires access to the program.

update_program(program_id: int, **kwargs) -> Dict[str, Any]

Parameter Type Default Description
program_id int
**kwargs {}

Returns: Dict[str, Any]

Method NavigatorToolkit.get_program

Get a program by ID or slug. Requires access to the program.

get_program(entity_id: Optional[int] = None, entity_slug: Optional[str] = None, **kwargs) -> Dict[str, Any]

Parameter Type Default Description
entity_id Optional[int] None
entity_slug Optional[str] None
**kwargs {}

Returns: Dict[str, Any]

Method NavigatorToolkit.list_programs

List Navigator programs the current user has access to.

list_programs(active_only: bool = True, limit: int = 50, **kwargs) -> Dict[str, Any]

Parameter Type Default Description
active_only bool True
limit int 50
**kwargs {}

Returns: Dict[str, Any]

Method NavigatorToolkit.create_module

Create a Navigator module with optional menu hierarchy and permissions.

Program can be specified by ID or slug (e.g., 'google360'). Clients can be specified by IDs or slugs (e.g., 'navigator_new').

Modules support parent-child hierarchy via the attributes JSON:

  • Set menu_type='parent' with parent_img and parent_menu for parent modules
  • Set menu_type='child' with menu_id=[parent_ids] for child modules

create_module(module_name: str, module_slug: str, program_id: Optional[int] = None, program_slug: Optional[str] = None, classname: Optional[str] = None, description: Optional[str] = None, active: bool = True, parent_module_id: Optional[int] = None, attributes: Optional[Dict[str, Any]] = None, allow_filtering: Optional[bool] = None, filtering_show: Optional[Dict[str, Any]] = None, conditions: Optional[Dict[str, Any]] = None, client_ids: Optional[List[int]] = None, client_slugs: Optional[List[str]] = None, group_ids: List[int] = None, confirm_execution: bool = False) -> Dict[str, Any]

Parameter Type Default Description
module_name str
module_slug str
program_id Optional[int] None
program_slug Optional[str] None
classname Optional[str] None
description Optional[str] None
active bool True
parent_module_id Optional[int] None
attributes Optional[Dict[str, Any]] None
allow_filtering Optional[bool] None
filtering_show Optional[Dict[str, Any]] None
conditions Optional[Dict[str, Any]] None
client_ids Optional[List[int]] None
client_slugs Optional[List[str]] None
group_ids List[int] None
confirm_execution bool False

Returns: Dict[str, Any]

Method NavigatorToolkit.update_module

Update an existing Navigator module. Requires write access.

update_module(module_id: int, **kwargs) -> Dict[str, Any]

Parameter Type Default Description
module_id int
**kwargs {}

Returns: Dict[str, Any]

Method NavigatorToolkit.get_module

Get a module by ID or Slug. Requires access to the module.

get_module(entity_id: Optional[int] = None, entity_slug: Optional[str] = None, **kwargs) -> Dict[str, Any]

Parameter Type Default Description
entity_id Optional[int] None
entity_slug Optional[str] None
**kwargs {}

Returns: Dict[str, Any]

Method NavigatorToolkit.list_modules

List Navigator modules the current user has access to.

list_modules(program_id: Optional[int] = None, active_only: bool = True, limit: int = 50, sort_by_newest: bool = False, **kwargs) -> Dict[str, Any]

Parameter Type Default Description
program_id Optional[int] None
active_only bool True
limit int 50
sort_by_newest bool False
**kwargs {}

Returns: Dict[str, Any]

Method NavigatorToolkit.create_dashboard

Create a new Navigator dashboard inside a module.

Program and module can be specified by ID or slug/name.

create_dashboard(name: str, module_id: Optional[int] = None, module_slug: Optional[str] = None, program_id: Optional[int] = None, program_slug: Optional[str] = None, description: Optional[str] = None, dashboard_type: str = '3', position: int = 1, enabled: bool = True, shared: bool = False, published: bool = True, allow_filtering: bool = True, allow_widgets: bool = True, params: Optional[Dict[str, Any]] = None, attributes: Optional[Dict[str, Any]] = None, conditions: Optional[Dict[str, Any]] = None, user_id: Optional[int] = None, save_filtering: bool = True, slug: Optional[str] = None, cond_definition: Optional[Dict[str, Any]] = None, filtering_show: Optional[Dict[str, Any]] = None, confirm_execution: bool = False) -> Dict[str, Any]

Parameter Type Default Description
name str
module_id Optional[int] None
module_slug Optional[str] None
program_id Optional[int] None
program_slug Optional[str] None
description Optional[str] None
dashboard_type str '3'
position int 1
enabled bool True
shared bool False
published bool True
allow_filtering bool True
allow_widgets bool True
params Optional[Dict[str, Any]] None
attributes Optional[Dict[str, Any]] None
conditions Optional[Dict[str, Any]] None
user_id Optional[int] None
save_filtering bool True
slug Optional[str] None
cond_definition Optional[Dict[str, Any]] None
filtering_show Optional[Dict[str, Any]] None
confirm_execution bool False

Returns: Dict[str, Any]

Method NavigatorToolkit.update_dashboard

Update an existing Navigator dashboard. Requires write access.

update_dashboard(dashboard_id: str, confirm_execution: bool = False, **kwargs) -> Dict[str, Any]

Parameter Type Default Description
dashboard_id str
confirm_execution bool False
**kwargs {}

Returns: Dict[str, Any]

Method NavigatorToolkit.get_dashboard

Get a dashboard by UUID or Name. Requires access to the dashboard.

get_dashboard(entity_uuid: Optional[str] = None, entity_slug: Optional[str] = None, **kwargs) -> Dict[str, Any]

Parameter Type Default Description
entity_uuid Optional[str] None
entity_slug Optional[str] None
**kwargs {}

Returns: Dict[str, Any]

Method NavigatorToolkit.list_dashboards

List dashboards the current user has access to.

list_dashboards(program_id: Optional[int] = None, module_id: Optional[int] = None, active_only: bool = True, limit: int = 50, **kwargs) -> Dict[str, Any]

Parameter Type Default Description
program_id Optional[int] None
module_id Optional[int] None
active_only bool True
limit int 50
**kwargs {}

Returns: Dict[str, Any]

Method NavigatorToolkit.publish_dashboard

Publish a draft dashboard — promote to system-wide.

Transitions a personal/draft dashboard into a published/system one in a single atomic update::

is_system : False → True
user_id   : <owner_id> → NULL     (ownership released)

Use this when the user says 'publicar', 'publish', 'finalizar', or 'mark as system' — typically after creating a dashboard and adding widgets in draft mode, the admin is done editing and wants the dashboard to become part of the system view shared across the program's users.

Idempotent: if the dashboard is already is_system=True, returns {"already_published": True} without executing the UPDATE.

publish_dashboard(dashboard_id: str, confirm_execution: bool = False) -> Dict[str, Any]

Parameter Type Default Description
dashboard_id str
confirm_execution bool False

Returns: Dict[str, Any]

Method NavigatorToolkit.clone_dashboard

Clone a dashboard and all its active widgets to a new dashboard.

If target_module_id or target_program_id are not provided, the cloned dashboard stays in the same module/program. Requires access to the source dashboard. If targeting a different program, also requires access to the target program.

clone_dashboard(source_dashboard_id: str, new_name: str, target_module_id: Optional[int] = None, target_program_id: Optional[int] = None, user_id: Optional[int] = None, confirm_execution: bool = False) -> Dict[str, Any]

Parameter Type Default Description
source_dashboard_id str
new_name str
target_module_id Optional[int] None
target_program_id Optional[int] None
user_id Optional[int] None
confirm_execution bool False

Returns: Dict[str, Any]

Method NavigatorToolkit.create_widget

Create a widget inside a dashboard.

Dashboard can be specified by UUID or name. Program can be specified by ID or slug.

create_widget(dashboard_id: Optional[str] = None, dashboard_name: Optional[str] = None, program_id: Optional[int] = None, program_slug: Optional[str] = None, widget_type_id: str = 'api-echarts', template_id: Optional[str] = None, widget_name: Optional[str] = None, title: Optional[str] = None, widgetcat_id: int = 3, module_id: Optional[int] = None, url: Optional[str] = None, params: Optional[Dict[str, Any]] = None, attributes: Optional[Dict[str, Any]] = None, conditions: Optional[Dict[str, Any]] = None, format_definition: Optional[Dict[str, Any]] = None, query_slug: Optional[Dict[str, Any]] = None, grid_position: Optional[Dict[str, int]] = None, user_id: Optional[int] = None, description: Optional[str] = None, cond_definition: Optional[Dict[str, Any]] = None, where_definition: Optional[Dict[str, Any]] = None, embed: Optional[str] = None, confirm_execution: bool = False) -> Dict[str, Any]

Parameter Type Default Description
dashboard_id Optional[str] None
dashboard_name Optional[str] None
program_id Optional[int] None
program_slug Optional[str] None
widget_type_id str 'api-echarts'
template_id Optional[str] None
widget_name Optional[str] None
title Optional[str] None
widgetcat_id int 3
module_id Optional[int] None
url Optional[str] None
params Optional[Dict[str, Any]] None
attributes Optional[Dict[str, Any]] None
conditions Optional[Dict[str, Any]] None
format_definition Optional[Dict[str, Any]] None
query_slug Optional[Dict[str, Any]] None
grid_position Optional[Dict[str, int]] None
user_id Optional[int] None
description Optional[str] None
cond_definition Optional[Dict[str, Any]] None
where_definition Optional[Dict[str, Any]] None
embed Optional[str] None
confirm_execution bool False

Returns: Dict[str, Any]

Method NavigatorToolkit.update_widget

Update an existing widget. Only provided fields are changed. Requires write access to the widget's program.

update_widget(widget_id: str, confirm_execution: bool = False, **kwargs) -> Dict[str, Any]

Parameter Type Default Description
widget_id str
confirm_execution bool False
**kwargs {}

Returns: Dict[str, Any]

Method NavigatorToolkit.get_widget

Get a widget by UUID or Name. Requires access to the widget.

get_widget(entity_uuid: Optional[str] = None, entity_slug: Optional[str] = None, **kwargs) -> Dict[str, Any]

Parameter Type Default Description
entity_uuid Optional[str] None
entity_slug Optional[str] None
**kwargs {}

Returns: Dict[str, Any]

Method NavigatorToolkit.list_widgets

List widgets the current user has access to.

list_widgets(dashboard_id: Optional[str] = None, program_id: Optional[int] = None, active_only: bool = True, limit: int = 50, **kwargs) -> Dict[str, Any]

Parameter Type Default Description
dashboard_id Optional[str] None
program_id Optional[int] None
active_only bool True
limit int 50
**kwargs {}

Returns: Dict[str, Any]

Method NavigatorToolkit.assign_module_to_client

Activate a module for a specific client within a program. Requires superuser access.

assign_module_to_client(client_id: int, program_id: int, module_id: int, active: bool = True, confirm_execution: bool = False) -> Dict[str, Any]

Parameter Type Default Description
client_id int
program_id int
module_id int
active bool True
confirm_execution bool False

Returns: Dict[str, Any]

Method NavigatorToolkit.assign_module_to_group

Grant a group access to a module within a specific client context. Requires superuser access.

assign_module_to_group(group_id: int, module_id: int, program_id: int, client_id: int, active: bool = True, confirm_execution: bool = False) -> Dict[str, Any]

Parameter Type Default Description
group_id int
module_id int
program_id int
client_id int
active bool True
confirm_execution bool False

Returns: Dict[str, Any]

Method NavigatorToolkit.list_widget_types

List all available widget types in the platform (108 types).

list_widget_types() -> Dict[str, Any]

Returns: Dict[str, Any]

Method NavigatorToolkit.list_widget_categories

List all widget categories (6 categories: generic, walmart, utility, mso, blank, loreal).

list_widget_categories() -> Dict[str, Any]

Returns: Dict[str, Any]

Method NavigatorToolkit.list_clients

List Navigator clients (tenants). Returns up to 500 by default.

list_clients(active_only: bool = True, limit: int = 500, **kwargs) -> Dict[str, Any]

Parameter Type Default Description
active_only bool True
limit int 500
**kwargs {}

Returns: Dict[str, Any]

Method NavigatorToolkit.list_groups

List auth groups, optionally filtered by client.

list_groups(client_id: Optional[int] = None, active_only: bool = True, limit: int = 50, **kwargs) -> Dict[str, Any]

Parameter Type Default Description
client_id Optional[int] None
active_only bool True
limit int 50
**kwargs {}

Returns: Dict[str, Any]

Method NavigatorToolkit.get_widget_schema

Get the full JSON configuration schema for a specific widget type.

Returns the widget_type definition, a real production template example with its complete params/conditions/format_definition/query_slug JSON, and usage notes. Use this when you need the exact JSON structure to create a widget of this type.

get_widget_schema(widget_type_id: str) -> Dict[str, Any]

Parameter Type Default Description
widget_type_id str The widget type (e.g., 'api-echarts', 'api-card', 'media-editor-wysiwyg')

Returns: Dict[str, Any]

Method NavigatorToolkit.find_widget_templates

Find available widget templates for a given widget type.

Templates are reusable base configurations. When creating a widget, reference a template_id and only override the fields you need to change (typically query_slug, conditions, and sometimes params).

find_widget_templates(widget_type_id: str, program_id: Optional[int] = None, limit: int = 10) -> Dict[str, Any]

Parameter Type Default Description
widget_type_id str Filter by widget type (e.g., 'api-echarts')
program_id Optional[int] None Optionally filter by program
limit int 10 Max results (default 10)

Returns: Dict[str, Any]

Method NavigatorToolkit.search_widget_docs

Search the Navigator widget documentation using PageIndex tree-search.

Uses LLM reasoning over a hierarchical document tree to find the most relevant sections. Returns detailed configuration docs, JSON examples, and the LLM's reasoning about why those sections match.

This is the Layer 2 retrieval — use it when you need detailed configuration docs for a specific widget type or feature. For the exact DB schema of a widget type, use get_widget_schema() instead.

search_widget_docs(query: str) -> Dict[str, Any]

Parameter Type Default Description
query str Natural language search (e.g., "How to configure drilldowns in api-card?")

Returns: Dict[str, Any]

Method NavigatorToolkit.get_full_program_structure

Get the complete structure of a program: modules, dashboards, and widget count.

Useful for understanding the full layout of a program before making changes. Requires access to the program.

get_full_program_structure(entity_id: Optional[int] = None, entity_slug: Optional[str] = None, **kwargs) -> Dict[str, Any]

Parameter Type Default Description
entity_id Optional[int] None
entity_slug Optional[str] None
**kwargs {}

Returns: Dict[str, Any]

Method NavigatorToolkit.search

Search across Navigator entities by name, slug, or title.

Results are scoped to entities the current user has access to. If entity_type is not specified, searches programs, modules, dashboards, and widgets.

search(query: str, entity_type: Optional[str] = None, limit: int = 20) -> Dict[str, Any]

Parameter Type Default Description
query str
entity_type Optional[str] None
limit int 20

Returns: Dict[str, Any]

Alias ProgramCreateInput

Re-exported from parrot_tools.navigator.schemas.ProgramCreateInput.

Alias ProgramUpdateInput

Re-exported from parrot_tools.navigator.schemas.ProgramUpdateInput.

Alias PublishDashboardInput

Re-exported from parrot_tools.navigator.schemas.PublishDashboardInput.

Alias SearchInput

Re-exported from parrot_tools.navigator.schemas.SearchInput.

Alias WidgetCreateInput

Re-exported from parrot_tools.navigator.schemas.WidgetCreateInput.

Alias WidgetUpdateInput

Re-exported from parrot_tools.navigator.schemas.WidgetUpdateInput.

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally