myco:api-endpoint-serializer-authoring

Author FastAPI endpoints and mutation-ack serializers for the apps/api UniFi REST server.

777|101|Updated Apr 21, 2025
One-click install
npx skills add https://github.com/sirkirby/unifi-network-mcp --skill myco-api-endpoint-serializer-authoring
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: myco:api-endpoint-serializer-authoring
Source: https://github.com/sirkirby/unifi-network-mcp/tree/main/.agents/skills/api-endpoint-serializer-authoring
Command: npx skills add https://github.com/sirkirby/unifi-network-mcp --skill myco-api-endpoint-serializer-authoring

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Adding endpoints and serializers to the apps/api UniFi REST server involves strict conventions—resource vs. action classification, cursor pagination, ManagerFactory wiring, Phase 5A routing patterns, and two CI gates—and violating any of them breaks the build or fails route-coverage tests.

Core Features & Use Cases

  • Endpoint Authoring Rules: Classifies resource endpoints (409 on missing product) versus action endpoints (200 with capability_not_available envelope), wires Cursor-based pagination, and enforces the unifi-core-only dependency boundary.
  • Serializer Authoring: Covers the @register_serializer(tools={...}) decorator, the seven RenderKind values, field-curation discipline, and registry reset for test isolation.
  • CI Gate Guidance: Explains validate_manifest and test_resource_route_coverage, including the test-only TOOL_ROUTE_OVERRIDES mapping.
  • Use Case: When adding a new DNS mutation endpoint to apps/api, apply this skill to register the FastAPI route, write a DETAIL mutation-ack serializer, and pass both CI gates on the first run.

Quick Start

Apply this skill to add a new resource endpoint with its mutation-ack serializer to apps/api and make the route-coverage tests pass.

Frequently Asked Questions about myco:api-endpoint-serializer-authoring

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a new endpoint to a FastAPI app with cursor pagination?

Classify it as a resource or action endpoint, then use Cursor and paginate() from services/pagination.py to decode the cursor and return a page plus next cursor. Default limit is 50 with a maximum of 200, and the cursor is exposed as an opaque query-string parameter.

How do I register a serializer for a mutation tool?

Use the @register_serializer decorator with the tools={...} dict form mapping each tool name to a RenderKind, then implement a static serialize method. The tool_name=/kind= keyword form does not exist; single-tool registrations can pass a list instead.

Should a missing product return 404, 409, or 200 for an API endpoint?

Resource endpoints return HTTP 409 when the required product is absent because the resource is implied to exist. Action endpoints always return HTTP 200 with a capability_not_available envelope, never 404 or 409.

Why does test_resource_route_coverage fail after adding a route?

The test requires every read tool to have a registered GET route whose name follows the default convention. If your route function name differs, add an entry to TOOL_ROUTE_OVERRIDES in the test file, but note this mapping is test-only and does not register the route itself.

Can apps/api import from unifi-mcp-shared?

No. apps/api may only import from unifi-core; importing unifi-mcp-shared is a build-time error because it couples the REST server to MCP protocol concerns. Serializers and render hints likewise stay in apps/api and never leak into managers or MCP tools.