Skip to content

AI Models API Package

nautobot_ai_models.api

REST API module for nautobot_ai_models app.

serializers

API serializers for nautobot_ai_models.

The MCP tool serializer carries the whole advertised definition, both schemas included.

AIAgentFallbackSerializer

Bases: NautobotModelSerializer

AI Agent Fallback Serializer.

Source code in nautobot_ai_models/api/serializers.py
class AIAgentFallbackSerializer(NautobotModelSerializer):  # pylint: disable=too-many-ancestors
    """AI Agent Fallback Serializer."""

    class Meta:
        """Meta attributes."""

        model = models.AIAgentFallback
        fields = "__all__"
Meta

Meta attributes.

Source code in nautobot_ai_models/api/serializers.py
class Meta:
    """Meta attributes."""

    model = models.AIAgentFallback
    fields = "__all__"

AIAgentSerializer

Bases: NautobotModelSerializer, TaggedModelSerializerMixin

AI Agent Serializer.

Source code in nautobot_ai_models/api/serializers.py
class AIAgentSerializer(NautobotModelSerializer, TaggedModelSerializerMixin):  # pylint: disable=too-many-ancestors
    """AI Agent Serializer."""

    is_available = drf_serializers.BooleanField(read_only=True)
    tool_count = drf_serializers.SerializerMethodField()

    class Meta:
        """Meta attributes."""

        model = models.AIAgent
        fields = "__all__"

    def get_tool_count(self, obj) -> int:
        """How many tools this agent may call.

        This method reads the annotation the viewset adds, and falls back to a count, so a queryset
        without the annotation still serialises.

        Args:
            obj (AIAgent): The agent to render.

        Returns:
            The viewset's annotation, or a count when the object did not come from that queryset.
        """
        count = getattr(obj, "tool_count", None)
        return obj.tool_bindings.count() if count is None else count
Meta

Meta attributes.

Source code in nautobot_ai_models/api/serializers.py
class Meta:
    """Meta attributes."""

    model = models.AIAgent
    fields = "__all__"
get_tool_count(obj)

How many tools this agent may call.

This method reads the annotation the viewset adds, and falls back to a count, so a queryset without the annotation still serialises.

Parameters:

Name Type Description Default
obj AIAgent

The agent to render.

required

Returns:

Type Description
int

The viewset's annotation, or a count when the object did not come from that queryset.

Source code in nautobot_ai_models/api/serializers.py
def get_tool_count(self, obj) -> int:
    """How many tools this agent may call.

    This method reads the annotation the viewset adds, and falls back to a count, so a queryset
    without the annotation still serialises.

    Args:
        obj (AIAgent): The agent to render.

    Returns:
        The viewset's annotation, or a count when the object did not come from that queryset.
    """
    count = getattr(obj, "tool_count", None)
    return obj.tool_bindings.count() if count is None else count

AIAgentSkillSerializer

Bases: NautobotModelSerializer

AI Agent Skill Serializer.

Source code in nautobot_ai_models/api/serializers.py
class AIAgentSkillSerializer(NautobotModelSerializer):  # pylint: disable=too-many-ancestors
    """AI Agent Skill Serializer."""

    class Meta:
        """Meta attributes."""

        model = models.AIAgentSkill
        fields = "__all__"
Meta

Meta attributes.

Source code in nautobot_ai_models/api/serializers.py
class Meta:
    """Meta attributes."""

    model = models.AIAgentSkill
    fields = "__all__"

AIAgentSubagentSerializer

Bases: NautobotModelSerializer

AI Agent Subagent Serializer.

Source code in nautobot_ai_models/api/serializers.py
class AIAgentSubagentSerializer(NautobotModelSerializer):  # pylint: disable=too-many-ancestors
    """AI Agent Subagent Serializer."""

    wire_name = drf_serializers.CharField(read_only=True)
    wire_description = drf_serializers.CharField(read_only=True)

    class Meta:
        """Meta attributes."""

        model = models.AIAgentSubagent
        fields = "__all__"
Meta

Meta attributes.

Source code in nautobot_ai_models/api/serializers.py
class Meta:
    """Meta attributes."""

    model = models.AIAgentSubagent
    fields = "__all__"

AIAgentThreadSerializer

Bases: NautobotModelSerializer

AI Agent Thread Serializer.

thread_id is neither read-only nor writable here. The column is editable=False, so the server allocates the value and returns it. A consuming app reads it back from the response and checkpoints under it.

Source code in nautobot_ai_models/api/serializers.py
class AIAgentThreadSerializer(NautobotModelSerializer):  # pylint: disable=too-many-ancestors
    """AI Agent Thread Serializer.

    `thread_id` is neither read-only nor writable here. The column is ``editable=False``, so the
    server allocates the value and returns it. A consuming app reads it back from the response and
    checkpoints under it.
    """

    is_live = drf_serializers.BooleanField(read_only=True)

    class Meta:
        """Meta attributes."""

        model = models.AIAgentThread
        fields = "__all__"
Meta

Meta attributes.

Source code in nautobot_ai_models/api/serializers.py
class Meta:
    """Meta attributes."""

    model = models.AIAgentThread
    fields = "__all__"

AIAgentToolSerializer

Bases: NautobotModelSerializer

AI Agent Tool Serializer.

The four resolved fields are what the model is told. They come from the binding and its target, so they are read-only, and they are worth a return: a client that checks what an agent offers must not have to work them out again.

Source code in nautobot_ai_models/api/serializers.py
class AIAgentToolSerializer(NautobotModelSerializer):  # pylint: disable=too-many-ancestors
    """AI Agent Tool Serializer.

    The four resolved fields are what the model is told. They come from the binding and its
    target, so they are read-only, and they are worth a return: a client that checks what an agent
    offers must not have to work them out again.
    """

    wire_name = drf_serializers.CharField(read_only=True)
    wire_description = drf_serializers.CharField(read_only=True)
    writable = drf_serializers.BooleanField(read_only=True)
    fingerprint = drf_serializers.CharField(read_only=True)
    is_approved = drf_serializers.BooleanField(read_only=True)
    mcp_kind = drf_serializers.CharField(read_only=True)

    class Meta:
        """Meta attributes."""

        model = models.AIAgentTool
        fields = "__all__"
Meta

Meta attributes.

Source code in nautobot_ai_models/api/serializers.py
class Meta:
    """Meta attributes."""

    model = models.AIAgentTool
    fields = "__all__"

AIModelSerializer

Bases: NautobotModelSerializer

AI Model Serializer.

Source code in nautobot_ai_models/api/serializers.py
class AIModelSerializer(NautobotModelSerializer):  # pylint: disable=too-many-ancestors
    """AI Model Serializer."""

    is_available = drf_serializers.BooleanField(read_only=True)
    resolved_parameters = drf_serializers.JSONField(read_only=True)

    class Meta:
        """Meta attributes."""

        model = models.AIModel
        fields = "__all__"
Meta

Meta attributes.

Source code in nautobot_ai_models/api/serializers.py
class Meta:
    """Meta attributes."""

    model = models.AIModel
    fields = "__all__"

AIProviderSerializer

Bases: NautobotModelSerializer

AI Provider Serializer.

Source code in nautobot_ai_models/api/serializers.py
class AIProviderSerializer(NautobotModelSerializer):  # pylint: disable=too-many-ancestors
    """AI Provider Serializer."""

    class Meta:
        """Meta attributes."""

        model = models.AIProvider
        fields = "__all__"
Meta

Meta attributes.

Source code in nautobot_ai_models/api/serializers.py
class Meta:
    """Meta attributes."""

    model = models.AIProvider
    fields = "__all__"

AISkillSerializer

Bases: NautobotModelSerializer

AI Skill Serializer.

Source code in nautobot_ai_models/api/serializers.py
class AISkillSerializer(NautobotModelSerializer):  # pylint: disable=too-many-ancestors
    """AI Skill Serializer."""

    is_available = drf_serializers.BooleanField(read_only=True)

    class Meta:
        """Meta attributes."""

        model = models.AISkill
        fields = "__all__"
Meta

Meta attributes.

Source code in nautobot_ai_models/api/serializers.py
class Meta:
    """Meta attributes."""

    model = models.AISkill
    fields = "__all__"

AIToolApprovalSerializer

Bases: NautobotModelSerializer

AI Tool Approval Serializer.

The digest and the reviewer are read-only. A client that could write them could write a record that says whatever it wants, which is not a record.

Source code in nautobot_ai_models/api/serializers.py
class AIToolApprovalSerializer(NautobotModelSerializer):  # pylint: disable=too-many-ancestors
    """AI Tool Approval Serializer.

    The digest and the reviewer are read-only. A client that could write them could write a record
    that says whatever it wants, which is not a record.
    """

    fingerprint = drf_serializers.CharField(read_only=True)
    approved_by_name = drf_serializers.CharField(read_only=True)
    revoked_by_name = drf_serializers.CharField(read_only=True)
    is_current = drf_serializers.BooleanField(read_only=True)
    is_expired = drf_serializers.BooleanField(read_only=True)
    is_active = drf_serializers.BooleanField(read_only=True)

    class Meta:
        """Meta attributes."""

        model = models.AIToolApproval
        fields = "__all__"
Meta

Meta attributes.

Source code in nautobot_ai_models/api/serializers.py
class Meta:
    """Meta attributes."""

    model = models.AIToolApproval
    fields = "__all__"

AIToolSerializer

Bases: NautobotModelSerializer

AI Tool Serializer.

What discovery wrote about the tool is read-only, because the next Sync AI Tools Job run would overwrite a change to it. The rest stays writable: a Job tool is an operator's decision, not a discovery, and AITool.clean() refuses a row that names nothing real.

Source code in nautobot_ai_models/api/serializers.py
class AIToolSerializer(NautobotModelSerializer):  # pylint: disable=too-many-ancestors
    """AI Tool Serializer.

    What discovery wrote about the tool is read-only, because the next Sync AI Tools Job run would
    overwrite a change to it. The rest stays writable: a Job tool is an operator's decision, not a
    discovery, and `AITool.clean()` refuses a row that names nothing real.
    """

    is_available = drf_serializers.BooleanField(read_only=True)

    class Meta:
        """Meta attributes."""

        model = models.AITool
        fields = "__all__"
        read_only_fields = ["advertised_read_only", "definition_fingerprint", "last_seen_at"]
Meta

Meta attributes.

Source code in nautobot_ai_models/api/serializers.py
class Meta:
    """Meta attributes."""

    model = models.AITool
    fields = "__all__"
    read_only_fields = ["advertised_read_only", "definition_fingerprint", "last_seen_at"]

AIUsageBudgetSerializer

Bases: NautobotModelSerializer

AI Usage Budget Serializer.

The three spend figures are read-only, the same way an approval's digest is read-only.

Source code in nautobot_ai_models/api/serializers.py
class AIUsageBudgetSerializer(NautobotModelSerializer):  # pylint: disable=too-many-ancestors
    """AI Usage Budget Serializer.

    The three spend figures are read-only, the same way an approval's digest is read-only.
    """

    spent_cost = drf_serializers.DecimalField(max_digits=12, decimal_places=4, read_only=True)
    spent_tokens = drf_serializers.IntegerField(read_only=True)
    is_exceeded = drf_serializers.BooleanField(read_only=True)

    class Meta:
        """Meta attributes."""

        model = models.AIUsageBudget
        fields = "__all__"
Meta

Meta attributes.

Source code in nautobot_ai_models/api/serializers.py
class Meta:
    """Meta attributes."""

    model = models.AIUsageBudget
    fields = "__all__"

AIUsageRecordSerializer

Bases: ValidatedModelSerializer

AI Usage Record Serializer.

Not a NautobotModelSerializer: the model is a BaseModel, so it has no custom fields, no tags, no notes, and no relationships for that class to serialise.

The two cost fields are read-only. They are frozen at the price of the day when the row is written, and a client that could set them could rewrite last quarter's bill.

Source code in nautobot_ai_models/api/serializers.py
class AIUsageRecordSerializer(ValidatedModelSerializer):  # pylint: disable=too-many-ancestors
    """AI Usage Record Serializer.

    Not a `NautobotModelSerializer`: the model is a `BaseModel`, so it has no custom fields, no
    tags, no notes, and no relationships for that class to serialise.

    The two cost fields are read-only. They are frozen at the price of the day when the row is
    written, and a client that could set them could rewrite last quarter's bill.
    """

    input_cost = drf_serializers.DecimalField(
        max_digits=COST_MAX_DIGITS,
        decimal_places=COST_DECIMAL_PLACES,
        read_only=True,
    )
    output_cost = drf_serializers.DecimalField(
        max_digits=COST_MAX_DIGITS,
        decimal_places=COST_DECIMAL_PLACES,
        read_only=True,
    )
    total_tokens = drf_serializers.IntegerField(read_only=True)
    total_cost = drf_serializers.DecimalField(
        max_digits=COST_MAX_DIGITS,
        decimal_places=COST_DECIMAL_PLACES,
        read_only=True,
    )

    class Meta:
        """Meta attributes."""

        model = models.AIUsageRecord
        fields = "__all__"
Meta

Meta attributes.

Source code in nautobot_ai_models/api/serializers.py
class Meta:
    """Meta attributes."""

    model = models.AIUsageRecord
    fields = "__all__"

MCPPromptSerializer

Bases: NautobotModelSerializer

MCP Prompt Serializer.

Source code in nautobot_ai_models/api/serializers.py
class MCPPromptSerializer(NautobotModelSerializer):  # pylint: disable=too-many-ancestors
    """MCP Prompt Serializer."""

    is_available = drf_serializers.BooleanField(read_only=True)
    required_arguments = drf_serializers.ListField(read_only=True)

    class Meta:
        """Meta attributes."""

        model = models.MCPPrompt
        fields = "__all__"
Meta

Meta attributes.

Source code in nautobot_ai_models/api/serializers.py
class Meta:
    """Meta attributes."""

    model = models.MCPPrompt
    fields = "__all__"

MCPResourceSerializer

Bases: NautobotModelSerializer

MCP Resource Serializer.

Source code in nautobot_ai_models/api/serializers.py
class MCPResourceSerializer(NautobotModelSerializer):  # pylint: disable=too-many-ancestors
    """MCP Resource Serializer."""

    is_available = drf_serializers.BooleanField(read_only=True)

    class Meta:
        """Meta attributes."""

        model = models.MCPResource
        fields = "__all__"
Meta

Meta attributes.

Source code in nautobot_ai_models/api/serializers.py
class Meta:
    """Meta attributes."""

    model = models.MCPResource
    fields = "__all__"

MCPServerSerializer

Bases: NautobotModelSerializer, TaggedModelSerializerMixin

MCPServer Serializer.

Source code in nautobot_ai_models/api/serializers.py
class MCPServerSerializer(NautobotModelSerializer, TaggedModelSerializerMixin):  # pylint: disable=too-many-ancestors
    """MCPServer Serializer."""

    tool_count = drf_serializers.SerializerMethodField()

    class Meta:
        """Meta attributes."""

        model = models.MCPServer
        fields = "__all__"

        read_only_fields = list(MCP_SERVER_DISCOVERED_FIELDS)

    def get_tool_count(self, obj) -> int:
        """Return how many tools this server offers.

        Args:
            obj (MCPServer): The server being rendered.

        Returns:
            The viewset's annotation, or a count when the object did not come from that queryset.
        """
        count = getattr(obj, "tool_count", None)
        return obj.tools.count() if count is None else count
Meta

Meta attributes.

Source code in nautobot_ai_models/api/serializers.py
class Meta:
    """Meta attributes."""

    model = models.MCPServer
    fields = "__all__"

    read_only_fields = list(MCP_SERVER_DISCOVERED_FIELDS)
get_tool_count(obj)

Return how many tools this server offers.

Parameters:

Name Type Description Default
obj MCPServer

The server being rendered.

required

Returns:

Type Description
int

The viewset's annotation, or a count when the object did not come from that queryset.

Source code in nautobot_ai_models/api/serializers.py
def get_tool_count(self, obj) -> int:
    """Return how many tools this server offers.

    Args:
        obj (MCPServer): The server being rendered.

    Returns:
        The viewset's annotation, or a count when the object did not come from that queryset.
    """
    count = getattr(obj, "tool_count", None)
    return obj.tools.count() if count is None else count

MCPToolSerializer

Bases: NautobotModelSerializer

MCPTool Serializer.

Source code in nautobot_ai_models/api/serializers.py
class MCPToolSerializer(NautobotModelSerializer):  # pylint: disable=too-many-ancestors
    """MCPTool Serializer."""

    is_available = drf_serializers.BooleanField(read_only=True)

    class Meta:
        """Meta attributes."""

        model = models.MCPTool
        fields = "__all__"

        read_only_fields = [
            "definition_fingerprint",
            "last_seen_at",
        ]
Meta

Meta attributes.

Source code in nautobot_ai_models/api/serializers.py
class Meta:
    """Meta attributes."""

    model = models.MCPTool
    fields = "__all__"

    read_only_fields = [
        "definition_fingerprint",
        "last_seen_at",
    ]

urls

Django API urlpatterns declaration for nautobot_ai_models app.

views

API views for nautobot_ai_models.

AIAgentFallbackViewSet

Bases: NautobotModelViewSet

AI Agent Fallback viewset.

Source code in nautobot_ai_models/api/views.py
class AIAgentFallbackViewSet(NautobotModelViewSet):  # pylint: disable=too-many-ancestors
    """AI Agent Fallback viewset."""

    queryset = models.AIAgentFallback.objects.select_related("agent", "model")
    serializer_class = serializers.AIAgentFallbackSerializer
    filterset_class = filters.AIAgentFallbackFilterSet

AIAgentSkillViewSet

Bases: NautobotModelViewSet

AI Agent Skill viewset.

Source code in nautobot_ai_models/api/views.py
class AIAgentSkillViewSet(NautobotModelViewSet):  # pylint: disable=too-many-ancestors
    """AI Agent Skill viewset."""

    queryset = models.AIAgentSkill.objects.select_related("agent", "skill")
    serializer_class = serializers.AIAgentSkillSerializer
    filterset_class = filters.AIAgentSkillFilterSet

AIAgentSubagentViewSet

Bases: NautobotModelViewSet

AI Agent Subagent viewset.

Source code in nautobot_ai_models/api/views.py
class AIAgentSubagentViewSet(NautobotModelViewSet):  # pylint: disable=too-many-ancestors
    """AI Agent Subagent viewset."""

    queryset = models.AIAgentSubagent.objects.select_related("parent", "subagent")
    serializer_class = serializers.AIAgentSubagentSerializer
    filterset_class = filters.AIAgentSubagentFilterSet

AIAgentThreadViewSet

Bases: NautobotModelViewSet

AI Agent Thread viewset.

Source code in nautobot_ai_models/api/views.py
class AIAgentThreadViewSet(NautobotModelViewSet):  # pylint: disable=too-many-ancestors
    """AI Agent Thread viewset."""

    queryset = models.AIAgentThread.objects.select_related("agent")
    serializer_class = serializers.AIAgentThreadSerializer
    filterset_class = filters.AIAgentThreadFilterSet

AIAgentToolViewSet

Bases: NautobotModelViewSet

AI Agent Tool viewset.

Source code in nautobot_ai_models/api/views.py
class AIAgentToolViewSet(NautobotModelViewSet):  # pylint: disable=too-many-ancestors
    """AI Agent Tool viewset."""

    queryset = models.AIAgentTool.objects.for_list()
    serializer_class = serializers.AIAgentToolSerializer
    filterset_class = filters.AIAgentToolFilterSet

AIAgentViewSet

Bases: NautobotModelViewSet

AI Agent viewset.

Source code in nautobot_ai_models/api/views.py
class AIAgentViewSet(NautobotModelViewSet):  # pylint: disable=too-many-ancestors
    """AI Agent viewset."""

    queryset = models.AIAgent.objects.select_related("model__provider", "tenant").annotate(
        tool_count=count_related(models.AIAgentTool, "agent")
    )
    serializer_class = serializers.AIAgentSerializer
    filterset_class = filters.AIAgentFilterSet

AIModelViewSet

Bases: NautobotModelViewSet

AI Model viewset.

Source code in nautobot_ai_models/api/views.py
class AIModelViewSet(NautobotModelViewSet):  # pylint: disable=too-many-ancestors
    """AI Model viewset."""

    queryset = models.AIModel.objects.select_related("provider")
    serializer_class = serializers.AIModelSerializer
    filterset_class = filters.AIModelFilterSet

AIProviderViewSet

Bases: NautobotModelViewSet

AI Provider viewset.

Source code in nautobot_ai_models/api/views.py
class AIProviderViewSet(NautobotModelViewSet):  # pylint: disable=too-many-ancestors
    """AI Provider viewset."""

    queryset = models.AIProvider.objects.select_related("external_integration")
    serializer_class = serializers.AIProviderSerializer
    filterset_class = filters.AIProviderFilterSet

AISkillViewSet

Bases: NautobotModelViewSet

AI Skill viewset.

Source code in nautobot_ai_models/api/views.py
class AISkillViewSet(NautobotModelViewSet):  # pylint: disable=too-many-ancestors
    """AI Skill viewset."""

    queryset = models.AISkill.objects.all()
    serializer_class = serializers.AISkillSerializer
    filterset_class = filters.AISkillFilterSet

AIToolApprovalViewSet

Bases: NautobotModelViewSet

AIToolApproval viewset.

Source code in nautobot_ai_models/api/views.py
class AIToolApprovalViewSet(NautobotModelViewSet):  # pylint: disable=too-many-ancestors
    """AIToolApproval viewset."""

    queryset = models.AIToolApproval.objects.for_list()
    serializer_class = serializers.AIToolApprovalSerializer
    filterset_class = filters.AIToolApprovalFilterSet

AIToolViewSet

Bases: NautobotModelViewSet

AI Tool viewset.

Source code in nautobot_ai_models/api/views.py
class AIToolViewSet(NautobotModelViewSet):  # pylint: disable=too-many-ancestors
    """AI Tool viewset."""

    queryset = models.AITool.objects.select_related("job", "git_repository")
    serializer_class = serializers.AIToolSerializer
    filterset_class = filters.AIToolFilterSet

AIUsageBudgetViewSet

Bases: NautobotModelViewSet

AI Usage Budget viewset.

Source code in nautobot_ai_models/api/views.py
class AIUsageBudgetViewSet(NautobotModelViewSet):  # pylint: disable=too-many-ancestors
    """AI Usage Budget viewset."""

    queryset = models.AIUsageBudget.objects.select_related("agent", "model", "tenant")
    serializer_class = serializers.AIUsageBudgetSerializer
    filterset_class = filters.AIUsageBudgetFilterSet

AIUsageRecordViewSet

Bases: CreateModelMixin, ListModelMixin, RetrieveModelMixin, DestroyModelMixin, GenericViewSet

AIUsageRecord viewset.

Composed rather than a NautobotModelViewSet, because the model is a BaseModel and that class expects the change-logged surface.

Create is here and update is not. A consuming app writes a row after it makes a call, and DRF gives it a bulk write for free by posting a list. Nothing rewrites a spend that already happened; a wrong row is deleted.

Source code in nautobot_ai_models/api/views.py
class AIUsageRecordViewSet(  # pylint: disable=too-many-ancestors
    mixins.CreateModelMixin,
    mixins.ListModelMixin,
    mixins.RetrieveModelMixin,
    mixins.DestroyModelMixin,
    GenericViewSet,
):
    """AIUsageRecord viewset.

    Composed rather than a `NautobotModelViewSet`, because the model is a `BaseModel` and that
    class expects the change-logged surface.

    Create is here and update is not. A consuming app writes a row after it makes a call, and DRF
    gives it a bulk write for free by posting a list. Nothing rewrites a spend that already
    happened; a wrong row is deleted.
    """

    queryset = models.AIUsageRecord.objects.select_related("thread", "agent", "model")
    serializer_class = serializers.AIUsageRecordSerializer
    filterset_class = filters.AIUsageRecordFilterSet

    def get_serializer(self, *args, **kwargs):
        """Serialise a list of records as many, so one POST can carry a whole run."""
        if isinstance(kwargs.get("data"), list):
            kwargs["many"] = True
        return super().get_serializer(*args, **kwargs)
get_serializer(*args, **kwargs)

Serialise a list of records as many, so one POST can carry a whole run.

Source code in nautobot_ai_models/api/views.py
def get_serializer(self, *args, **kwargs):
    """Serialise a list of records as many, so one POST can carry a whole run."""
    if isinstance(kwargs.get("data"), list):
        kwargs["many"] = True
    return super().get_serializer(*args, **kwargs)

MCPPromptViewSet

Bases: NautobotModelViewSet

MCPPrompt viewset.

Source code in nautobot_ai_models/api/views.py
class MCPPromptViewSet(NautobotModelViewSet):  # pylint: disable=too-many-ancestors
    """MCPPrompt viewset."""

    queryset = models.MCPPrompt.objects.select_related("mcp_server")
    serializer_class = serializers.MCPPromptSerializer
    filterset_class = filters.MCPPromptFilterSet

MCPResourceViewSet

Bases: NautobotModelViewSet

MCPResource viewset.

Source code in nautobot_ai_models/api/views.py
class MCPResourceViewSet(NautobotModelViewSet):  # pylint: disable=too-many-ancestors
    """MCPResource viewset."""

    queryset = models.MCPResource.objects.select_related("mcp_server")
    serializer_class = serializers.MCPResourceSerializer
    filterset_class = filters.MCPResourceFilterSet

MCPServerViewSet

Bases: NautobotModelViewSet

MCPServer viewset.

Source code in nautobot_ai_models/api/views.py
class MCPServerViewSet(NautobotModelViewSet):  # pylint: disable=too-many-ancestors
    """MCPServer viewset."""

    queryset = models.MCPServer.objects.select_related("external_integration", "tenant").annotate(
        tool_count=count_related(models.MCPTool, "mcp_server")
    )
    serializer_class = serializers.MCPServerSerializer
    filterset_class = filters.MCPServerFilterSet

MCPToolViewSet

Bases: NautobotModelViewSet

MCPTool viewset.

Source code in nautobot_ai_models/api/views.py
class MCPToolViewSet(NautobotModelViewSet):  # pylint: disable=too-many-ancestors
    """MCPTool viewset."""

    queryset = models.MCPTool.objects.select_related("mcp_server")
    serializer_class = serializers.MCPToolSerializer
    filterset_class = filters.MCPToolFilterSet