register_api
Register APIs by ingesting OpenAPI specifications to parse specs, build dependency graphs, and create searchable embeddings for API orchestration.
Instructions
Register a new API by ingesting its OpenAPI specification. This parses the spec, builds a dependency graph, and creates searchable embeddings.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| api_id | Yes | Unique identifier for this API (e.g., 'stripe', 'github') | |
| spec_url | Yes | URL to the OpenAPI specification (JSON or YAML) |
Implementation Reference
- src/jitapi/mcp/tools.py:339-360 (handler)The _register_api function handles the core logic for the register_api tool, delegating the indexing of an OpenAPI spec to self.indexer.index_from_url.
async def _register_api(self, args: dict[str, Any]) -> ToolResult: """Register a new API.""" api_id = args["api_id"] spec_url = args["spec_url"] result = await self.indexer.index_from_url(api_id, spec_url) if result.success: return ToolResult( success=True, data={ "api_id": result.api_id, "title": result.title, "version": result.version, "endpoint_count": result.endpoint_count, "dependency_count": result.dependency_count, "message": f"Successfully registered {result.title} with {result.endpoint_count} endpoints", }, ) else: return ToolResult( success=False, - src/jitapi/mcp/models.py:13-22 (schema)RegisterApiInput defines the expected input schema for the register_api tool, including api_id and spec_url.
class RegisterApiInput(BaseModel): """Input for register_api tool.""" api_id: str = Field( ..., description="Unique identifier for this API", min_length=1, max_length=100, pattern=r"^[a-zA-Z0-9_-]+$", ) - src/jitapi/mcp/tools.py:287-287 (registration)The register_api tool is mapped to the _register_api handler method in the tools dispatcher dictionary.
"register_api": self._register_api,