Skip to content

feat(openapi): create openapi toolset#292

Open
AmaadMartin wants to merge 8 commits intogoogle:mainfrom
AmaadMartin:feat/openapi-tool
Open

feat(openapi): create openapi toolset#292
AmaadMartin wants to merge 8 commits intogoogle:mainfrom
AmaadMartin:feat/openapi-tool

Conversation

@AmaadMartin
Copy link
Copy Markdown
Collaborator

Link to Issue or Description of Change

Or, if no issue exists, describe the change:

Problem:
The adk-js repository lacked the ability to automatically generate tools from OpenAPI specifications, requiring developers to manually define tools for REST APIs and limiting parity with the Python implementation.

Solution:
Implemented the OpenAPI Toolset feature, adding a complete suite of tools and parsers to handle OpenAPI specifications:

  • OpenAPIToolset (openapi_toolset.ts): A new toolset class that parses an OpenAPI specification and generates a set of RestApiTool instances.
  • RestApiTool (rest_api_tool.ts): A generic tool capable of executing REST API calls, mapping arguments to path, query, header, and body parameters.
  • OpenApiSpecParser: Includes sanitizeSchemaTypes to ensure schema compatibility.
  • ToolAuthHandler: Includes a credential store in the session state for caching resolved credentials.

Testing Plan

Unit Tests:

  • I have added or updated unit tests for my change.
  • All unit tests pass locally.

Summary of passed results:

  • Added comprehensive unit tests for all new files, achieving an overall coverage of 95.14% for the openapi_tool directory.
  • Actual Line Coverage by File:
    • auth/auth_helpers.ts: 100%
    • openapi_spec_parser/tool_auth_handler.ts: 100%
    • auth/credential_exchangers/auto_auth_credential_exchanger.ts: 100%
    • rest_api_tool.ts: 95.78%
    • openapi_spec_parser/openapi_spec_parser.ts: 94.81%
    • openapi_spec_parser/operation_parser.ts: 93.60%
    • openapi_toolset.ts: 93.58%
    • auth/credential_exchangers/service_account_exchanger.ts: 93.54%

Integration Tests:

  • All integration tests pass locally.
  • Verified that OpenAPIToolset can parse sample specs and execute tools with mocked fetch.

Checklist

  • I have performed a self-review of my own code.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.

@kalenkevich kalenkevich self-requested a review April 24, 2026 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants