fileforge_api_action
Discover captured REST and GraphQL API calls, find OpenAPI specs, and export them as curl, Postman, or MSW mocks from a running DevTools session.
Instructions
Work with the API calls a page makes: discover REST and GraphQL requests, find OpenAPI specs, and export them as curl, Postman or MSW mocks. Reads a running DevTools session, so call start_session on fileforge_devtools_action first or results are empty. Exports replace a file of the same name and can include captured auth headers, so review them before sharing. Needs the extension.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| store | No | Save the result in ~/.fileforge and return a ref. | |
| tabId | No | Tab ID, or "active" for the active tab. | active |
| action | Yes | What to do. Required parameters are in brackets. discover: List the API calls captured in a tab, grouped by path, method or status and by domain. Stores the result by default. get_graphql_operations: List the GraphQL requests captured in a tab. Stores the result by default. find_openapi_specs: Send HEAD requests to common OpenAPI and Swagger paths on the tab's origin and list the ones found. export_curl: Write the captured API calls to a shell file as curl commands. export_postman: Write the captured API calls to a Postman collection file. generate_msw_mocks: Write the captured API calls to a file of MSW mock handlers. | |
| groupBy | No | Field to group API calls by. | route |
| filename | No | Output filename. | |
| includeBodies | No | Include response bodies. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | Yes | False if the action failed or a check did not pass. | |
| ref | No | Stored result ID, for fileforge_result_action. | |
| data | No | The result. Its shape depends on the action. | |
| meta | No | Tool, action and context. | |
| error | No | Failure code and message. | |
| warnings | No | Notes about a call that still ran. |