@apify/actors-mcp-server 0.17.4 → 0.17.5-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -1
- package/dist/apify_client.d.ts +10 -0
- package/dist/apify_client.d.ts.map +1 -1
- package/dist/apify_client.js +13 -4
- package/dist/apify_client.js.map +1 -1
- package/dist/const.d.ts +4 -0
- package/dist/const.d.ts.map +1 -1
- package/dist/const.js +5 -4
- package/dist/const.js.map +1 -1
- package/dist/dev_server.js +1 -4
- package/dist/dev_server.js.map +1 -1
- package/dist/errors.js +1 -4
- package/dist/errors.js.map +1 -1
- package/dist/index.js +1 -4
- package/dist/index.js.map +1 -1
- package/dist/index_internals.d.ts +3 -0
- package/dist/index_internals.d.ts.map +1 -1
- package/dist/index_internals.js +1 -4
- package/dist/index_internals.js.map +1 -1
- package/dist/index_internals_test_kit.js +1 -4
- package/dist/index_internals_test_kit.js.map +1 -1
- package/dist/input.js +1 -4
- package/dist/input.js.map +1 -1
- package/dist/instrument.js +1 -4
- package/dist/instrument.js.map +1 -1
- package/dist/mcp/actors.js +1 -4
- package/dist/mcp/actors.js.map +1 -1
- package/dist/mcp/client.js +1 -4
- package/dist/mcp/client.js.map +1 -1
- package/dist/mcp/client_context.js +1 -4
- package/dist/mcp/client_context.js.map +1 -1
- package/dist/mcp/const.js +1 -4
- package/dist/mcp/const.js.map +1 -1
- package/dist/mcp/errors.js +1 -4
- package/dist/mcp/errors.js.map +1 -1
- package/dist/mcp/legacy_server.js +1 -4
- package/dist/mcp/legacy_server.js.map +1 -1
- package/dist/mcp/proxy.js +1 -4
- package/dist/mcp/proxy.js.map +1 -1
- package/dist/mcp/remote_tool_call.js +1 -4
- package/dist/mcp/remote_tool_call.js.map +1 -1
- package/dist/mcp/server.js +1 -4
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/stateless_server.js +1 -4
- package/dist/mcp/stateless_server.js.map +1 -1
- package/dist/mcp/task_execution.js +1 -4
- package/dist/mcp/task_execution.js.map +1 -1
- package/dist/mcp/tool_call_engine.js +1 -4
- package/dist/mcp/tool_call_engine.js.map +1 -1
- package/dist/mcp/tool_call_error_mapper.js +1 -4
- package/dist/mcp/tool_call_error_mapper.js.map +1 -1
- package/dist/mcp/tool_call_telemetry.js +1 -4
- package/dist/mcp/tool_call_telemetry.js.map +1 -1
- package/dist/mcp/tool_dispatch.js +1 -4
- package/dist/mcp/tool_dispatch.js.map +1 -1
- package/dist/mcp/utils.js +1 -4
- package/dist/mcp/utils.js.map +1 -1
- package/dist/payments/const.js +1 -4
- package/dist/payments/const.js.map +1 -1
- package/dist/payments/helpers.d.ts +1 -1
- package/dist/payments/helpers.d.ts.map +1 -1
- package/dist/payments/helpers.js +6 -7
- package/dist/payments/helpers.js.map +1 -1
- package/dist/payments/index.js +1 -4
- package/dist/payments/index.js.map +1 -1
- package/dist/payments/resolve.js +1 -4
- package/dist/payments/resolve.js.map +1 -1
- package/dist/payments/skyfire.js +1 -4
- package/dist/payments/skyfire.js.map +1 -1
- package/dist/payments/types.js +1 -4
- package/dist/payments/types.js.map +1 -1
- package/dist/payments/x402.js +1 -4
- package/dist/payments/x402.js.map +1 -1
- package/dist/prompts/index.js +1 -4
- package/dist/prompts/index.js.map +1 -1
- package/dist/prompts/prompt_service.js +1 -4
- package/dist/prompts/prompt_service.js.map +1 -1
- package/dist/resources/api_resources.d.ts +5 -9
- package/dist/resources/api_resources.d.ts.map +1 -1
- package/dist/resources/api_resources.js +8 -25
- package/dist/resources/api_resources.js.map +1 -1
- package/dist/resources/resource_service.js +1 -4
- package/dist/resources/resource_service.js.map +1 -1
- package/dist/resources/widgets.js +1 -4
- package/dist/resources/widgets.js.map +1 -1
- package/dist/server_card.js +1 -4
- package/dist/server_card.js.map +1 -1
- package/dist/state.d.ts +3 -0
- package/dist/state.d.ts.map +1 -1
- package/dist/state.js +4 -4
- package/dist/state.js.map +1 -1
- package/dist/stdio.js +1 -4
- package/dist/stdio.js.map +1 -1
- package/dist/telemetry.js +1 -4
- package/dist/telemetry.js.map +1 -1
- package/dist/test_kit/cases/actors.cases.js +1 -4
- package/dist/test_kit/cases/actors.cases.js.map +1 -1
- package/dist/test_kit/cases/apps.cases.js +1 -4
- package/dist/test_kit/cases/apps.cases.js.map +1 -1
- package/dist/test_kit/cases/payments.cases.js +1 -4
- package/dist/test_kit/cases/payments.cases.js.map +1 -1
- package/dist/test_kit/cases/registration.cases.js +1 -4
- package/dist/test_kit/cases/registration.cases.js.map +1 -1
- package/dist/test_kit/cases/storage.cases.js +1 -4
- package/dist/test_kit/cases/storage.cases.js.map +1 -1
- package/dist/test_kit/cases/tasks.cases.js +1 -4
- package/dist/test_kit/cases/tasks.cases.js.map +1 -1
- package/dist/test_kit/cases/tools.cases.js +1 -4
- package/dist/test_kit/cases/tools.cases.js.map +1 -1
- package/dist/test_kit/helpers.js +1 -4
- package/dist/test_kit/helpers.js.map +1 -1
- package/dist/test_kit/index.js +1 -4
- package/dist/test_kit/index.js.map +1 -1
- package/dist/test_kit/mcp_client.js +1 -4
- package/dist/test_kit/mcp_client.js.map +1 -1
- package/dist/test_kit/register.js +1 -4
- package/dist/test_kit/register.js.map +1 -1
- package/dist/test_kit/tsconfig.tsbuildinfo +1 -1
- package/dist/test_kit/types.js +1 -4
- package/dist/test_kit/types.js.map +1 -1
- package/dist/tools/actor_input_schema.js +1 -4
- package/dist/tools/actor_input_schema.js.map +1 -1
- package/dist/tools/actor_tool_naming.js +1 -4
- package/dist/tools/actor_tool_naming.js.map +1 -1
- package/dist/tools/actors/actor_definition.js +1 -4
- package/dist/tools/actors/actor_definition.js.map +1 -1
- package/dist/tools/actors/actor_executor.js +1 -4
- package/dist/tools/actors/actor_executor.js.map +1 -1
- package/dist/tools/actors/actor_run_response.js +1 -4
- package/dist/tools/actors/actor_run_response.js.map +1 -1
- package/dist/tools/actors/actor_tools_factory.js +1 -4
- package/dist/tools/actors/actor_tools_factory.js.map +1 -1
- package/dist/tools/actors/call_actor.js +1 -4
- package/dist/tools/actors/call_actor.js.map +1 -1
- package/dist/tools/actors/delete_actor.js +1 -4
- package/dist/tools/actors/delete_actor.js.map +1 -1
- package/dist/tools/actors/fetch_actor_details.js +1 -4
- package/dist/tools/actors/fetch_actor_details.js.map +1 -1
- package/dist/tools/actors/get_actor_list.js +1 -4
- package/dist/tools/actors/get_actor_list.js.map +1 -1
- package/dist/tools/actors/search_actors.js +1 -4
- package/dist/tools/actors/search_actors.js.map +1 -1
- package/dist/tools/api/apify_api_details.d.ts +6 -0
- package/dist/tools/api/apify_api_details.d.ts.map +1 -0
- package/dist/tools/api/apify_api_details.js +90 -0
- package/dist/tools/api/apify_api_details.js.map +1 -0
- package/dist/tools/api/apify_api_read.d.ts +6 -0
- package/dist/tools/api/apify_api_read.d.ts.map +1 -0
- package/dist/tools/api/apify_api_read.js +67 -0
- package/dist/tools/api/apify_api_read.js.map +1 -0
- package/dist/tools/api/apify_api_request.d.ts +58 -0
- package/dist/tools/api/apify_api_request.d.ts.map +1 -0
- package/dist/tools/api/apify_api_request.js +288 -0
- package/dist/tools/api/apify_api_request.js.map +1 -0
- package/dist/tools/api/apify_api_search.d.ts +6 -0
- package/dist/tools/api/apify_api_search.d.ts.map +1 -0
- package/dist/tools/api/apify_api_search.js +81 -0
- package/dist/tools/api/apify_api_search.js.map +1 -0
- package/dist/tools/api/apify_api_spec.d.ts +49 -0
- package/dist/tools/api/apify_api_spec.d.ts.map +1 -0
- package/dist/tools/api/apify_api_spec.js +296 -0
- package/dist/tools/api/apify_api_spec.js.map +1 -0
- package/dist/tools/builds/build_actor.js +1 -4
- package/dist/tools/builds/build_actor.js.map +1 -1
- package/dist/tools/builds/build_helpers.js +1 -4
- package/dist/tools/builds/build_helpers.js.map +1 -1
- package/dist/tools/builds/get_actor_build.js +1 -4
- package/dist/tools/builds/get_actor_build.js.map +1 -1
- package/dist/tools/builds/get_actor_build_list.js +1 -4
- package/dist/tools/builds/get_actor_build_list.js.map +1 -1
- package/dist/tools/builds/get_actor_build_log.js +1 -4
- package/dist/tools/builds/get_actor_build_log.js.map +1 -1
- package/dist/tools/dev/report_problem.js +1 -4
- package/dist/tools/dev/report_problem.js.map +1 -1
- package/dist/tools/docs/fetch_apify_docs.js +1 -4
- package/dist/tools/docs/fetch_apify_docs.js.map +1 -1
- package/dist/tools/docs/search_apify_docs.js +1 -4
- package/dist/tools/docs/search_apify_docs.js.map +1 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +4 -4
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/registry.d.ts +1 -0
- package/dist/tools/registry.d.ts.map +1 -1
- package/dist/tools/registry.js +5 -4
- package/dist/tools/registry.js.map +1 -1
- package/dist/tools/runs/abort_actor_run.js +1 -4
- package/dist/tools/runs/abort_actor_run.js.map +1 -1
- package/dist/tools/runs/get_actor_run.js +1 -4
- package/dist/tools/runs/get_actor_run.js.map +1 -1
- package/dist/tools/runs/get_actor_run_list.js +1 -4
- package/dist/tools/runs/get_actor_run_list.js.map +1 -1
- package/dist/tools/runs/get_actor_run_log.js +1 -4
- package/dist/tools/runs/get_actor_run_log.js.map +1 -1
- package/dist/tools/schedules/create_schedule.js +1 -4
- package/dist/tools/schedules/create_schedule.js.map +1 -1
- package/dist/tools/schedules/delete_schedule.js +1 -4
- package/dist/tools/schedules/delete_schedule.js.map +1 -1
- package/dist/tools/schedules/get_schedule.js +1 -4
- package/dist/tools/schedules/get_schedule.js.map +1 -1
- package/dist/tools/schedules/schedule_helpers.js +1 -4
- package/dist/tools/schedules/schedule_helpers.js.map +1 -1
- package/dist/tools/schedules/update_schedule.js +1 -4
- package/dist/tools/schedules/update_schedule.js.map +1 -1
- package/dist/tools/source/get_actor_version.js +1 -4
- package/dist/tools/source/get_actor_version.js.map +1 -1
- package/dist/tools/source/source_files.js +1 -4
- package/dist/tools/source/source_files.js.map +1 -1
- package/dist/tools/storage/get_dataset.js +1 -4
- package/dist/tools/storage/get_dataset.js.map +1 -1
- package/dist/tools/storage/get_dataset_items.js +1 -4
- package/dist/tools/storage/get_dataset_items.js.map +1 -1
- package/dist/tools/storage/get_dataset_list.js +1 -4
- package/dist/tools/storage/get_dataset_list.js.map +1 -1
- package/dist/tools/storage/get_dataset_schema.js +1 -4
- package/dist/tools/storage/get_dataset_schema.js.map +1 -1
- package/dist/tools/storage/get_key_value_store.js +1 -4
- package/dist/tools/storage/get_key_value_store.js.map +1 -1
- package/dist/tools/storage/get_key_value_store_keys.js +1 -4
- package/dist/tools/storage/get_key_value_store_keys.js.map +1 -1
- package/dist/tools/storage/get_key_value_store_list.js +1 -4
- package/dist/tools/storage/get_key_value_store_list.js.map +1 -1
- package/dist/tools/storage/get_key_value_store_record.js +1 -4
- package/dist/tools/storage/get_key_value_store_record.js.map +1 -1
- package/dist/tools/storage/storage_helpers.js +1 -4
- package/dist/tools/storage/storage_helpers.js.map +1 -1
- package/dist/tools/structured_output_schemas.d.ts +141 -0
- package/dist/tools/structured_output_schemas.d.ts.map +1 -1
- package/dist/tools/structured_output_schemas.js +86 -4
- package/dist/tools/structured_output_schemas.js.map +1 -1
- package/dist/tools/tasks/create_actor_task.js +1 -4
- package/dist/tools/tasks/create_actor_task.js.map +1 -1
- package/dist/tools/tasks/get_actor_task.js +1 -4
- package/dist/tools/tasks/get_actor_task.js.map +1 -1
- package/dist/tools/tasks/publish_actor_task.js +1 -4
- package/dist/tools/tasks/publish_actor_task.js.map +1 -1
- package/dist/tools/tasks/task_helpers.js +1 -4
- package/dist/tools/tasks/task_helpers.js.map +1 -1
- package/dist/tools/tasks/unpublish_actor_task.js +1 -4
- package/dist/tools/tasks/unpublish_actor_task.js.map +1 -1
- package/dist/tools/tasks/update_actor_task.js +1 -4
- package/dist/tools/tasks/update_actor_task.js.map +1 -1
- package/dist/tools/widgets/call_actor_widget.js +1 -4
- package/dist/tools/widgets/call_actor_widget.js.map +1 -1
- package/dist/tools/widgets/fetch_actor_details_widget.js +1 -4
- package/dist/tools/widgets/fetch_actor_details_widget.js.map +1 -1
- package/dist/tools/widgets/get_actor_run_widget.js +1 -4
- package/dist/tools/widgets/get_actor_run_widget.js.map +1 -1
- package/dist/tools/widgets/search_actors_widget.js +1 -4
- package/dist/tools/widgets/search_actors_widget.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types.d.ts +6 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -4
- package/dist/types.js.map +1 -1
- package/dist/utils/actor.js +1 -4
- package/dist/utils/actor.js.map +1 -1
- package/dist/utils/actor_card.js +1 -4
- package/dist/utils/actor_card.js.map +1 -1
- package/dist/utils/actor_details.js +1 -4
- package/dist/utils/actor_details.js.map +1 -1
- package/dist/utils/actor_search.js +1 -4
- package/dist/utils/actor_search.js.map +1 -1
- package/dist/utils/ajv.js +1 -4
- package/dist/utils/ajv.js.map +1 -1
- package/dist/utils/apify_docs.js +1 -4
- package/dist/utils/apify_docs.js.map +1 -1
- package/dist/utils/apify_errors.js +1 -4
- package/dist/utils/apify_errors.js.map +1 -1
- package/dist/utils/apify_properties.js +1 -4
- package/dist/utils/apify_properties.js.map +1 -1
- package/dist/utils/auth.js +1 -4
- package/dist/utils/auth.js.map +1 -1
- package/dist/utils/console_link.js +1 -4
- package/dist/utils/console_link.js.map +1 -1
- package/dist/utils/encode_text.js +1 -4
- package/dist/utils/encode_text.js.map +1 -1
- package/dist/utils/generic.js +1 -4
- package/dist/utils/generic.js.map +1 -1
- package/dist/utils/logging.js +1 -4
- package/dist/utils/logging.js.map +1 -1
- package/dist/utils/mcp.d.ts +2 -2
- package/dist/utils/mcp.d.ts.map +1 -1
- package/dist/utils/mcp.js +8 -6
- package/dist/utils/mcp.js.map +1 -1
- package/dist/utils/mcp_clients.js +1 -4
- package/dist/utils/mcp_clients.js.map +1 -1
- package/dist/utils/payment_errors.js +1 -4
- package/dist/utils/payment_errors.js.map +1 -1
- package/dist/utils/pricing_info.js +1 -4
- package/dist/utils/pricing_info.js.map +1 -1
- package/dist/utils/progress.js +1 -4
- package/dist/utils/progress.js.map +1 -1
- package/dist/utils/schema_generation.js +1 -4
- package/dist/utils/schema_generation.js.map +1 -1
- package/dist/utils/server-instructions/index.d.ts.map +1 -1
- package/dist/utils/server-instructions/index.js +5 -5
- package/dist/utils/server-instructions/index.js.map +1 -1
- package/dist/utils/server_mode.js +1 -4
- package/dist/utils/server_mode.js.map +1 -1
- package/dist/utils/tool_categories_helpers.js +1 -4
- package/dist/utils/tool_categories_helpers.js.map +1 -1
- package/dist/utils/tool_status.js +1 -4
- package/dist/utils/tool_status.js.map +1 -1
- package/dist/utils/tools.d.ts.map +1 -1
- package/dist/utils/tools.js +5 -4
- package/dist/utils/tools.js.map +1 -1
- package/dist/utils/tools_loader.js +1 -4
- package/dist/utils/tools_loader.js.map +1 -1
- package/dist/utils/ttl_lru.js +1 -4
- package/dist/utils/ttl_lru.js.map +1 -1
- package/dist/utils/userid_cache.js +1 -4
- package/dist/utils/userid_cache.js.map +1 -1
- package/dist/utils/version.js +1 -4
- package/dist/utils/version.js.map +1 -1
- package/dist/web/dist/actor-run-widget.js +0 -2
- package/dist/web/dist/search-actors-widget.js +0 -2
- package/manifest.json +1 -1
- package/package.json +1 -1
- package/server.json +1 -1
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="dd6b7c03-5600-5e02-9f6c-414d8cb9ef50")}catch(e){}}();
|
|
3
1
|
import dedent from 'dedent';
|
|
4
2
|
import { z } from 'zod';
|
|
5
3
|
import { HELPER_TOOLS, MAX_LIMIT_WITH_INPUT_SCHEMA } from '../../const.js';
|
|
@@ -211,5 +209,4 @@ export const searchActors = Object.freeze({
|
|
|
211
209
|
return respondOk(`${header}\n\n${actorCardText}\n\n${footer}`, { structuredContent });
|
|
212
210
|
},
|
|
213
211
|
});
|
|
214
|
-
//# sourceMappingURL=search_actors.js.map
|
|
215
|
-
//# debugId=dd6b7c03-5600-5e02-9f6c-414d8cb9ef50
|
|
212
|
+
//# sourceMappingURL=search_actors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search_actors.js","sources":["../../../src/tools/actors/search_actors.ts"],"
|
|
1
|
+
{"version":3,"file":"search_actors.js","sourceRoot":"","sources":["../../../src/tools/actors/search_actors.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAW3E,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AACtH,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAC1F,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAE1E;;;GAGG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;SAyB3C,CAAC;IACN,K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
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { HELPER_TOOLS } from '../../const.js';
|
|
4
|
+
import { ALL_TOOLS_PRESENT, TOOL_TYPE } from '../../types.js';
|
|
5
|
+
import { compileSchema } from '../../utils/ajv.js';
|
|
6
|
+
import { respondOk, respondUserError } from '../../utils/mcp.js';
|
|
7
|
+
import { apifyApiDetailsOutputSchema } from '../structured_output_schemas.js';
|
|
8
|
+
import { findPathOperations, formatApiPath, formatList, normalizeApiPath, redactApiCallArgs, } from './apify_api_request.js';
|
|
9
|
+
import { API_METHODS, fetchApiOperationIndex } from './apify_api_spec.js';
|
|
10
|
+
const apifyApiDetailsArgs = z.object({
|
|
11
|
+
path: z
|
|
12
|
+
.string()
|
|
13
|
+
.min(1)
|
|
14
|
+
.describe('The API path, as a template such as /v2/datasets/{datasetId} or with its values in it, ' +
|
|
15
|
+
'such as /v2/datasets/abc. datasets/abc, v2/datasets/abc, and /v2/datasets/abc are the same.'),
|
|
16
|
+
method: z
|
|
17
|
+
.enum(API_METHODS)
|
|
18
|
+
.optional()
|
|
19
|
+
.describe('HTTP method of the operation. Omit it to get every operation on the path.'),
|
|
20
|
+
});
|
|
21
|
+
function buildDescription({ hasTool }) {
|
|
22
|
+
const findPath = hasTool(HELPER_TOOLS.API_SEARCH) ? ` Find the path with ${HELPER_TOOLS.API_SEARCH}.` : '';
|
|
23
|
+
return dedent `
|
|
24
|
+
Get the Apify API operations on a path: for each method, its description, path and query
|
|
25
|
+
parameters, and the JSON schema of its request body.${findPath}
|
|
26
|
+
Give a method to get only that operation, for example {"path": "/v2/datasets/abc", "method": "PUT"}.
|
|
27
|
+
|
|
28
|
+
USAGE:
|
|
29
|
+
- Use before calling an operation, to pass the right parameters and body.
|
|
30
|
+
|
|
31
|
+
USAGE EXAMPLES:
|
|
32
|
+
- user_input: What parameters does the dataset items operation take?
|
|
33
|
+
- user_input: How do I update a webhook through the API?
|
|
34
|
+
`;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Returns the operations on one path of the published Apify API spec, https://docs.apify.com/api/v2.
|
|
38
|
+
*/
|
|
39
|
+
export const apifyApiDetails = Object.freeze({
|
|
40
|
+
type: TOOL_TYPE.INTERNAL,
|
|
41
|
+
name: HELPER_TOOLS.API_DETAILS,
|
|
42
|
+
title: 'Get Apify API operation details',
|
|
43
|
+
description: buildDescription(ALL_TOOLS_PRESENT),
|
|
44
|
+
buildDescription,
|
|
45
|
+
inputSchema: z.toJSONSchema(apifyApiDetailsArgs),
|
|
46
|
+
outputSchema: apifyApiDetailsOutputSchema,
|
|
47
|
+
ajvValidate: compileSchema(z.toJSONSchema(apifyApiDetailsArgs)),
|
|
48
|
+
annotations: {
|
|
49
|
+
title: 'Get Apify API operation details',
|
|
50
|
+
readOnlyHint: true,
|
|
51
|
+
destructiveHint: false,
|
|
52
|
+
idempotentHint: true,
|
|
53
|
+
openWorldHint: false,
|
|
54
|
+
},
|
|
55
|
+
// A pasted path can hold a query such as ?token=.
|
|
56
|
+
redactArgs: redactApiCallArgs,
|
|
57
|
+
call: async (toolArgs) => {
|
|
58
|
+
const parsed = apifyApiDetailsArgs.parse(toolArgs.args);
|
|
59
|
+
const index = await fetchApiOperationIndex();
|
|
60
|
+
const normalizedPath = normalizeApiPath(parsed.path);
|
|
61
|
+
const path = formatApiPath(normalizedPath);
|
|
62
|
+
const matched = findPathOperations(index, normalizedPath);
|
|
63
|
+
if (matched.length === 0) {
|
|
64
|
+
const next = toolArgs.loadedToolNames.includes(HELPER_TOOLS.API_SEARCH)
|
|
65
|
+
? ` Find the path with ${HELPER_TOOLS.API_SEARCH}.`
|
|
66
|
+
: '';
|
|
67
|
+
return respondUserError(`The path ${path} is not in the API spec. A name is written username~name, or ~name for one ` +
|
|
68
|
+
`you own, as in /v2/actors/~my-actor.${next}`);
|
|
69
|
+
}
|
|
70
|
+
const operations = parsed.method ? matched.filter((operation) => operation.method === parsed.method) : matched;
|
|
71
|
+
if (operations.length === 0) {
|
|
72
|
+
const noun = matched.length === 1 ? 'method' : 'methods';
|
|
73
|
+
const methods = formatList(matched.map((operation) => operation.method), 'and');
|
|
74
|
+
return respondUserError(`The path ${path} has no ${parsed.method} operation; it matches ${noun} ${methods}.`);
|
|
75
|
+
}
|
|
76
|
+
const result = {
|
|
77
|
+
operations: operations.map((operation) => ({
|
|
78
|
+
method: operation.method,
|
|
79
|
+
path: operation.path,
|
|
80
|
+
summary: operation.summary,
|
|
81
|
+
description: operation.description,
|
|
82
|
+
parameters: operation.parameters,
|
|
83
|
+
...(operation.requestBody && { requestBody: operation.requestBody }),
|
|
84
|
+
})),
|
|
85
|
+
};
|
|
86
|
+
const summary = `${operations[0].path}: ${operations.map((operation) => operation.method).join(', ')}.`;
|
|
87
|
+
return respondOk([JSON.stringify(result), summary], { structuredContent: result });
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
//# sourceMappingURL=apify_api_details.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apify_api_details.js","sourceRoot":"","sources":["../../../src/tools/api/apify_api_details.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,EACH,kBAAkB,EAClB,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,iBAAiB,GACpB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAE1E,MAAM,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AAE,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;gBACvC,MAAM,EAAE,SAAS,CAAC,MAAM;gBACxB,IAAI,EAAE,SAAS,CAAC,IAAI;gBACpB,OAAO,EAAE,SAAS,CAAC,OAAO;gBAC1B,WAAW,EAAE,SAAS,CAAC,WAAW;gBAClC,UAAU,EAAE,SAAS,CAAC,UAAU;gBAChC,GAAG,CAAC,SAAS,CAAC,WAAW,IAAI,EAAE,WAAW,EAAE,SAAS,CAAC,WAAW,EAAE,CAAC;aACvE,CAAC,CAAC;SACN,CAAC;QACF,MAAM,OAAO,GAAG,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;QACxG,OAAO,SAAS,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,EAAE,EAAE,iBAAiB,EAAE,MAAM,EAAE,CAAC,CAAC;IACvF,CAAC;CACK,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apify_api_read.d.ts","sourceRoot":"","sources":["../../../src/tools/api/apify_api_read.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAA4C,SAAS,EAAmB,MAAM,gBAAgB,CAAC;AAgC3G;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,SA+BhB,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import dedent from 'dedent';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { HELPER_TOOLS, MAX_INLINE_BYTES } from '../../const.js';
|
|
4
|
+
import { ALL_TOOLS_PRESENT, TOOL_TYPE } from '../../types.js';
|
|
5
|
+
import { compileSchema } from '../../utils/ajv.js';
|
|
6
|
+
import { apifyApiCallOutputSchema } from '../structured_output_schemas.js';
|
|
7
|
+
import { API_CALL_DESCRIPTION, apiCallArgsShape, callApi, redactApiCallArgs } from './apify_api_request.js';
|
|
8
|
+
const apifyApiReadArgs = z.object(apiCallArgsShape);
|
|
9
|
+
function buildDescription({ hasTool }) {
|
|
10
|
+
const findPath = hasTool(HELPER_TOOLS.API_SEARCH) ? `\nFind the path with ${HELPER_TOOLS.API_SEARCH}.` : '';
|
|
11
|
+
const getParameters = hasTool(HELPER_TOOLS.API_DETAILS)
|
|
12
|
+
? `\nGet the operation's query parameters first with ${HELPER_TOOLS.API_DETAILS} and method GET.`
|
|
13
|
+
: '';
|
|
14
|
+
const runActor = hasTool(HELPER_TOOLS.ACTOR_CALL) ? ` Run an Actor with ${HELPER_TOOLS.ACTOR_CALL}.` : '';
|
|
15
|
+
return dedent `
|
|
16
|
+
Send a GET request to the Apify API at a path, such as /v2/actor-runs/abc.
|
|
17
|
+
A GET can start a paid Actor run, as the synchronous run endpoints do.${runActor}
|
|
18
|
+
${API_CALL_DESCRIPTION}${findPath}${getParameters}
|
|
19
|
+
Returns the response body as the API sends it, JSON with its data wrapper included; a body over
|
|
20
|
+
${MAX_INLINE_BYTES} bytes is not returned.
|
|
21
|
+
|
|
22
|
+
Example call: {"path": "/v2/webhook-dispatches", "query": {"limit": 10, "desc": true}}
|
|
23
|
+
|
|
24
|
+
USAGE:
|
|
25
|
+
- Use for data no dedicated tool returns, such as webhooks, usage, and limits.
|
|
26
|
+
|
|
27
|
+
USAGE EXAMPLES:
|
|
28
|
+
- user_input: List the webhooks on my account
|
|
29
|
+
- user_input: How much of my monthly usage have I spent?
|
|
30
|
+
`;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Sends a GET to a path of the Apify API, https://docs.apify.com/api/v2, as a proxy.
|
|
34
|
+
*/
|
|
35
|
+
export const apifyApiRead = Object.freeze({
|
|
36
|
+
type: TOOL_TYPE.INTERNAL,
|
|
37
|
+
name: HELPER_TOOLS.API_READ,
|
|
38
|
+
title: 'Read Apify API',
|
|
39
|
+
description: buildDescription(ALL_TOOLS_PRESENT),
|
|
40
|
+
buildDescription,
|
|
41
|
+
inputSchema: z.toJSONSchema(apifyApiReadArgs),
|
|
42
|
+
outputSchema: apifyApiCallOutputSchema,
|
|
43
|
+
ajvValidate: compileSchema(z.toJSONSchema(apifyApiReadArgs)),
|
|
44
|
+
annotations: {
|
|
45
|
+
title: 'Read Apify API',
|
|
46
|
+
// A GET can start a run, such as a synchronous run of an Actor or task.
|
|
47
|
+
readOnlyHint: false,
|
|
48
|
+
destructiveHint: false,
|
|
49
|
+
idempotentHint: false,
|
|
50
|
+
openWorldHint: true,
|
|
51
|
+
},
|
|
52
|
+
// A storage signature, or the webhooks of a synchronous run, would otherwise be logged.
|
|
53
|
+
redactArgs: redactApiCallArgs,
|
|
54
|
+
call: async (toolArgs) => {
|
|
55
|
+
const parsed = apifyApiReadArgs.parse(toolArgs.args);
|
|
56
|
+
return callApi({
|
|
57
|
+
client: toolArgs.apifyClient,
|
|
58
|
+
token: toolArgs.apifyToken,
|
|
59
|
+
method: 'GET',
|
|
60
|
+
path: parsed.path,
|
|
61
|
+
query: parsed.query,
|
|
62
|
+
signal: toolArgs.signal,
|
|
63
|
+
loadedToolNames: toolArgs.loadedToolNames,
|
|
64
|
+
});
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
//# sourceMappingURL=apify_api_read.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apify_api_read.js","sourceRoot":"","sources":["../../../src/tools/api/apify_api_read.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEhE,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,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AAC,CAAC;IAC5D,WAAW,EAAE;QACT,KAAK,EAAE,gBAAgB;QACvB,wEAAwE;QACxE,YAAY,EAAE,KAAK;QACnB,eAAe,EAAE,KAAK;QACtB,cAAc,EAAE,KAAK;QACrB,aAAa,EAAE,IAAI;KACtB;IACD,wFAAwF;IACxF,UAAU,EAAE,iBAAiB;IAC7B,IAAI,EAAE,KAAK,EAAE,QAA0B,EAAE,EAAE;QACvC,MAAM,MAAM,GAAG,gBAAgB,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACrD,OAAO,OAAO,CAAC;YACX,MAAM,EAAE,QAAQ,CAAC,WAAW;YAC5B,KAAK,EAAE,QAAQ,CAAC,UAAU;YAC1B,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,MAAM,EAAE,QAAQ,CAAC,MAAM;YACvB,eAAe,EAAE,QAAQ,CAAC,eAAe;SAC5C,CAAC,CAAC;IACP,CAAC;CACK,CAAC,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { ApifyClient } from '../../apify_client.js';
|
|
3
|
+
import type { ToolResponse } from '../../utils/mcp.js';
|
|
4
|
+
import type { ApiMethod, ApiOperation } from './apify_api_spec.js';
|
|
5
|
+
/** Input fields the read and write tools share. */
|
|
6
|
+
export declare const apiCallArgsShape: {
|
|
7
|
+
path: z.ZodString;
|
|
8
|
+
query: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
9
|
+
};
|
|
10
|
+
/** The shared description lines of the read and write tools. */
|
|
11
|
+
export declare const API_CALL_DESCRIPTION = "A proxy to the Apify API, like apify api in the Apify CLI; the server adds the host and the API token.\nWrite the path as actors, v2/actors, or /v2/actors, with its values in it.\nA name is written username~name, or ~name for one you own, as in /v2/actors/~my-actor.\nSynchronous runs, and waitForFinish above 45 seconds, outlast the usual 60-second tool-call timeout,\nso prefer asynchronous runs.";
|
|
12
|
+
/**
|
|
13
|
+
* The logged copy of an API tool call's arguments (`redactArgs`), built as an allowlist. Secret query
|
|
14
|
+
* values, a query written into the path, the body, and a path or query of the wrong type are logged
|
|
15
|
+
* only as a marker. The body can carry environment variable values, webhook headers, or stored records.
|
|
16
|
+
*/
|
|
17
|
+
export declare function redactApiCallArgs({ path, method, query, body }: Record<string, unknown>): {
|
|
18
|
+
body?: string | undefined;
|
|
19
|
+
path: unknown;
|
|
20
|
+
method: unknown;
|
|
21
|
+
query: unknown;
|
|
22
|
+
};
|
|
23
|
+
/** A path without its leading slash and `v2/` prefix, as `apify api` takes it: `/v2/actors` becomes `actors`. */
|
|
24
|
+
export declare function normalizeApiPath(path: string): string;
|
|
25
|
+
/** A normalized path as the tools report it, with the `/v2/` prefix. */
|
|
26
|
+
export declare function formatApiPath(normalizedPath: string): string;
|
|
27
|
+
/**
|
|
28
|
+
* The operations on the one path template a normalized path, with values or as a template, matches. When
|
|
29
|
+
* several match, the one with more literal segments wins, so `request-queues/x/requests/batch` is the
|
|
30
|
+
* batch operation, not a request with the ID `batch`.
|
|
31
|
+
*/
|
|
32
|
+
export declare function findPathOperations(index: Map<string, ApiOperation>, normalizedPath: string): ApiOperation[];
|
|
33
|
+
/**
|
|
34
|
+
* Up to five path templates closest to a normalized path, best first, scored as the Apify CLI's
|
|
35
|
+
* `findClosestEndpoints`.
|
|
36
|
+
*/
|
|
37
|
+
export declare function findClosestApiPaths(index: Map<string, ApiOperation>, normalizedPath: string): string[];
|
|
38
|
+
/** Words in a sentence, with an Oxford comma: `GET, PUT, and DELETE`. */
|
|
39
|
+
export declare function formatList(words: readonly string[], conjunction: 'and' | 'or'): string;
|
|
40
|
+
/**
|
|
41
|
+
* Sends one request to an API path and returns the response body, like `apify api` in the Apify CLI.
|
|
42
|
+
* The URL is the client's base URL and the normalized path, not encoded again, with `query` added.
|
|
43
|
+
* It sends with `sendApifyApiRequest` (one attempt, body capped at `MAX_INLINE_BYTES`) and throws a
|
|
44
|
+
* non-2xx response as apify-client's `ApifyApiError`, so it gets the usual tool error text and telemetry.
|
|
45
|
+
*/
|
|
46
|
+
export declare function callApi(params: {
|
|
47
|
+
client: ApifyClient;
|
|
48
|
+
/** The session's token, masked in the response. */
|
|
49
|
+
token?: string;
|
|
50
|
+
method: ApiMethod;
|
|
51
|
+
path: string;
|
|
52
|
+
query?: Record<string, string | number | boolean>;
|
|
53
|
+
/** Aborts the request when the client cancels the tool call. */
|
|
54
|
+
signal?: AbortSignal;
|
|
55
|
+
/** The session's tools, to name a dedicated log tool when a log is too large. */
|
|
56
|
+
loadedToolNames: readonly string[];
|
|
57
|
+
}): Promise<ToolResponse>;
|
|
58
|
+
//# sourceMappingURL=apify_api_request.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apify_api_request.d.ts","sourceRoot":"","sources":["../../../src/tools/api/apify_api_request.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAIzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGvD,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGnE,mDAAmD;AACnD,eAAO,MAAM,gBAAgB;;;CAa5B,CAAC;AAEF,gEAAgE;AAChE,eAAO,MAAM,oBAAoB,mZAIJ,CAAC;AAQ9B;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;EAkBvF;AAED,iHAAiH;AACjH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAErD;AAED,wEAAwE;AACxE,wBAAgB,aAAa,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CAE5D;AAiCD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,EAAE,cAAc,EAAE,MAAM,GAAG,YAAY,EAAE,CAe3G;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,EAAE,cAAc,EAAE,MAAM,GAAG,MAAM,EAAE,CAmBtG;AAED,yEAAyE;AACzE,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,EAAE,WAAW,EAAE,KAAK,GAAG,IAAI,GAAG,MAAM,CAGtF;AA2FD;;;;;GAKG;AACH,wBAAsB,OAAO,CAAC,MAAM,EAAE;IAClC,MAAM,EAAE,WAAW,CAAC;IACpB,mDAAmD;IACnD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,SAAS,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC;IAClD,gEAAgE;IAChE,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,iFAAiF;IACjF,eAAe,EAAE,SAAS,MAAM,EAAE,CAAC;CACtC,GAAG,OAAO,CAAC,YAAY,CAAC,CAkDxB"}
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import { setTimeout as sleep } from 'node:timers/promises';
|
|
2
|
+
import { ApifyApiError } from 'apify-client';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { sendApifyApiRequest } from '../../apify_client.js';
|
|
5
|
+
import { APIFY_ERROR_TYPE_PAGE_NOT_FOUND, HELPER_TOOLS, MAX_INLINE_BYTES } from '../../const.js';
|
|
6
|
+
import { isApifyApiUri, isMaxContentLengthAbort } from '../../resources/api_resources.js';
|
|
7
|
+
import { respondAborted, respondOk, respondUserError } from '../../utils/mcp.js';
|
|
8
|
+
import { WAIT_SECS_MAX } from '../actors/actor_run_response.js';
|
|
9
|
+
import { fetchApiOperationIndex, isRecord } from './apify_api_spec.js';
|
|
10
|
+
/** Input fields the read and write tools share. */
|
|
11
|
+
export const apiCallArgsShape = {
|
|
12
|
+
path: z
|
|
13
|
+
.string()
|
|
14
|
+
.min(1)
|
|
15
|
+
.describe('The API path with its values in it: actors, v2/actors, and /v2/actors are the same. A name is ' +
|
|
16
|
+
'written username~name, or ~name for one you own, as in /v2/actors/~my-actor. ' +
|
|
17
|
+
'A query string written into the path is sent too.'),
|
|
18
|
+
query: z
|
|
19
|
+
.record(z.string(), z.union([z.string(), z.number(), z.boolean()]))
|
|
20
|
+
.optional()
|
|
21
|
+
.describe('Query parameters, by name, for example {"limit": 10}. Added to a query string in the path.'),
|
|
22
|
+
};
|
|
23
|
+
/** The shared description lines of the read and write tools. */
|
|
24
|
+
export const API_CALL_DESCRIPTION = `A proxy to the Apify API, like apify api in the Apify CLI; the server adds the host and the API token.
|
|
25
|
+
Write the path as actors, v2/actors, or /v2/actors, with its values in it.
|
|
26
|
+
A name is written username~name, or ~name for one you own, as in /v2/actors/~my-actor.
|
|
27
|
+
Synchronous runs, and waitForFinish above ${WAIT_SECS_MAX} seconds, outlast the usual 60-second tool-call timeout,
|
|
28
|
+
so prefer asynchronous runs.`;
|
|
29
|
+
/** Query parameters whose values grant access or carry secrets; `webhooks` can hold webhook headers. */
|
|
30
|
+
const SECRET_QUERY_PARAMS = ['token', 'signature', 'webhooks'];
|
|
31
|
+
/** Stands in for a logged or returned value that may carry a secret. */
|
|
32
|
+
const REDACTED = '[REDACTED]';
|
|
33
|
+
/**
|
|
34
|
+
* The logged copy of an API tool call's arguments (`redactArgs`), built as an allowlist. Secret query
|
|
35
|
+
* values, a query written into the path, the body, and a path or query of the wrong type are logged
|
|
36
|
+
* only as a marker. The body can carry environment variable values, webhook headers, or stored records.
|
|
37
|
+
*/
|
|
38
|
+
export function redactApiCallArgs({ path, method, query, body }) {
|
|
39
|
+
let loggedQuery;
|
|
40
|
+
if (isRecord(query)) {
|
|
41
|
+
loggedQuery = Object.fromEntries(Object.entries(query).map(([name, value]) => [name, SECRET_QUERY_PARAMS.includes(name) ? REDACTED : value]));
|
|
42
|
+
}
|
|
43
|
+
else if (query !== undefined) {
|
|
44
|
+
loggedQuery = REDACTED;
|
|
45
|
+
}
|
|
46
|
+
let loggedPath;
|
|
47
|
+
if (typeof path === 'string')
|
|
48
|
+
loggedPath = path.replace(/[?#][\s\S]*$/, `?${REDACTED}`);
|
|
49
|
+
else if (path !== undefined)
|
|
50
|
+
loggedPath = REDACTED;
|
|
51
|
+
return {
|
|
52
|
+
path: loggedPath,
|
|
53
|
+
method,
|
|
54
|
+
query: loggedQuery,
|
|
55
|
+
...(body !== undefined && { body: REDACTED }),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
/** A path without its leading slash and `v2/` prefix, as `apify api` takes it: `/v2/actors` becomes `actors`. */
|
|
59
|
+
export function normalizeApiPath(path) {
|
|
60
|
+
return path.replace(/^\//, '').replace(/^v2\//i, '');
|
|
61
|
+
}
|
|
62
|
+
/** A normalized path as the tools report it, with the `/v2/` prefix. */
|
|
63
|
+
export function formatApiPath(normalizedPath) {
|
|
64
|
+
return `/v2/${normalizedPath}`;
|
|
65
|
+
}
|
|
66
|
+
/** A path without the query string or fragment written into it. */
|
|
67
|
+
function stripQuery(path) {
|
|
68
|
+
return path.replace(/[?#][\s\S]*$/, '');
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* A normalized path as the spec lists it, without its query. The API routes the legacy `acts` prefix,
|
|
72
|
+
* which apify-client and the CLI send, to the same handler as `actors`, the only prefix the spec lists.
|
|
73
|
+
*/
|
|
74
|
+
function toSpecPath(normalizedPath) {
|
|
75
|
+
return stripQuery(normalizedPath).replace(/^acts(?=\/|$)/, 'actors');
|
|
76
|
+
}
|
|
77
|
+
const PATH_PARAMETER_SEGMENT_REGEX = /^\{[^{}]+\}$/;
|
|
78
|
+
/** How many literal segments of the template match the path segments, or `undefined` when it does not match. */
|
|
79
|
+
function countMatchingLiterals(template, segments) {
|
|
80
|
+
const templateSegments = normalizeApiPath(template).split('/');
|
|
81
|
+
if (templateSegments.length !== segments.length)
|
|
82
|
+
return undefined;
|
|
83
|
+
let literalCount = 0;
|
|
84
|
+
for (const [position, templateSegment] of templateSegments.entries()) {
|
|
85
|
+
if (PATH_PARAMETER_SEGMENT_REGEX.test(templateSegment)) {
|
|
86
|
+
if (!segments[position])
|
|
87
|
+
return undefined;
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
if (templateSegment !== segments[position])
|
|
91
|
+
return undefined;
|
|
92
|
+
literalCount += 1;
|
|
93
|
+
}
|
|
94
|
+
return literalCount;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* The operations on the one path template a normalized path, with values or as a template, matches. When
|
|
98
|
+
* several match, the one with more literal segments wins, so `request-queues/x/requests/batch` is the
|
|
99
|
+
* batch operation, not a request with the ID `batch`.
|
|
100
|
+
*/
|
|
101
|
+
export function findPathOperations(index, normalizedPath) {
|
|
102
|
+
const segments = toSpecPath(normalizedPath).split('/');
|
|
103
|
+
let bestLiteralCount = -1;
|
|
104
|
+
let operations = [];
|
|
105
|
+
for (const operation of index.values()) {
|
|
106
|
+
const literalCount = countMatchingLiterals(operation.path, segments);
|
|
107
|
+
if (literalCount === undefined || literalCount < bestLiteralCount)
|
|
108
|
+
continue;
|
|
109
|
+
if (literalCount > bestLiteralCount) {
|
|
110
|
+
bestLiteralCount = literalCount;
|
|
111
|
+
operations = [operation];
|
|
112
|
+
}
|
|
113
|
+
else if (operation.path === operations[0].path) {
|
|
114
|
+
operations.push(operation);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return operations;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Up to five path templates closest to a normalized path, best first, scored as the Apify CLI's
|
|
121
|
+
* `findClosestEndpoints`.
|
|
122
|
+
*/
|
|
123
|
+
export function findClosestApiPaths(index, normalizedPath) {
|
|
124
|
+
const input = toSpecPath(normalizedPath).toLowerCase();
|
|
125
|
+
const inputSegments = input.split('/').filter(Boolean);
|
|
126
|
+
const scores = new Map();
|
|
127
|
+
for (const template of new Set([...index.values()].map((operation) => operation.path))) {
|
|
128
|
+
const candidate = normalizeApiPath(template).toLowerCase();
|
|
129
|
+
let score = candidate.includes(input) || input.includes(candidate) ? 10 : 0;
|
|
130
|
+
const segments = candidate.split('/').filter(Boolean);
|
|
131
|
+
for (let position = 0; position < Math.min(inputSegments.length, segments.length); position++) {
|
|
132
|
+
if (segments[position] === inputSegments[position])
|
|
133
|
+
score += 2;
|
|
134
|
+
else if (segments[position].startsWith('{'))
|
|
135
|
+
score += 1;
|
|
136
|
+
}
|
|
137
|
+
if (segments.length === inputSegments.length)
|
|
138
|
+
score += 1;
|
|
139
|
+
if (score > 0)
|
|
140
|
+
scores.set(template, score);
|
|
141
|
+
}
|
|
142
|
+
return [...scores]
|
|
143
|
+
.sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0]))
|
|
144
|
+
.slice(0, 5)
|
|
145
|
+
.map(([template]) => template);
|
|
146
|
+
}
|
|
147
|
+
/** Words in a sentence, with an Oxford comma: `GET, PUT, and DELETE`. */
|
|
148
|
+
export function formatList(words, conjunction) {
|
|
149
|
+
if (words.length <= 2)
|
|
150
|
+
return words.join(` ${conjunction} `);
|
|
151
|
+
return `${words.slice(0, -1).join(', ')}, ${conjunction} ${words.at(-1)}`;
|
|
152
|
+
}
|
|
153
|
+
/** How long a hint waits for the spec, so a stalled download does not hold back the API's answer. */
|
|
154
|
+
const HINT_SPEC_TIMEOUT_MS = 5000;
|
|
155
|
+
/**
|
|
156
|
+
* The index, or `undefined` when the spec cannot be loaded within a few seconds or the call is
|
|
157
|
+
* cancelled; for the hints that only help.
|
|
158
|
+
*/
|
|
159
|
+
async function fetchApiOperationIndexIfAvailable(signal) {
|
|
160
|
+
return Promise.race([
|
|
161
|
+
fetchApiOperationIndex(),
|
|
162
|
+
sleep(HINT_SPEC_TIMEOUT_MS, undefined, { signal, ref: false }),
|
|
163
|
+
]).catch(() => undefined);
|
|
164
|
+
}
|
|
165
|
+
/** Query parameters that make a response smaller. */
|
|
166
|
+
const NARROWING_QUERY_PARAMS = ['limit', 'offset', 'fields', 'omit'];
|
|
167
|
+
/** The dedicated tool that returns the end of a log too large for the API tools, when the session has it. */
|
|
168
|
+
function findLogToolName(path, loadedToolNames) {
|
|
169
|
+
if (!/\/log$|^\/v2\/logs\//.test(path))
|
|
170
|
+
return undefined;
|
|
171
|
+
const toolName = path.startsWith('/v2/actor-builds/') ? HELPER_TOOLS.ACTOR_BUILD_LOG : HELPER_TOOLS.ACTOR_RUNS_LOG;
|
|
172
|
+
return loadedToolNames.includes(toolName) ? toolName : undefined;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* The message of a response over the inline limit. It names the parameters that narrow the response
|
|
176
|
+
* when the path matches an operation of the spec that declares them.
|
|
177
|
+
*/
|
|
178
|
+
async function formatOversizeMessage({ method, normalizedPath, loadedToolNames, signal, }) {
|
|
179
|
+
var _a;
|
|
180
|
+
const path = formatApiPath(normalizedPath);
|
|
181
|
+
const message = `The response of ${method} ${path} is larger than ${MAX_INLINE_BYTES} bytes, so it is not returned.`;
|
|
182
|
+
const index = await fetchApiOperationIndexIfAvailable(signal);
|
|
183
|
+
const operation = index && findPathOperations(index, normalizedPath).find((match) => match.method === method);
|
|
184
|
+
const narrowingNames = ((_a = operation === null || operation === void 0 ? void 0 : operation.parameters) !== null && _a !== void 0 ? _a : [])
|
|
185
|
+
.filter((parameter) => parameter.in === 'query' && NARROWING_QUERY_PARAMS.includes(parameter.name))
|
|
186
|
+
.map((parameter) => parameter.name);
|
|
187
|
+
if (narrowingNames.length > 0) {
|
|
188
|
+
return `${message} Narrow the request with the ${formatList(narrowingNames, 'or')} query parameter.`;
|
|
189
|
+
}
|
|
190
|
+
const logToolName = findLogToolName(stripQuery(path), loadedToolNames);
|
|
191
|
+
return logToolName ? `${message} Get the end of the log with ${logToolName} instead.` : message;
|
|
192
|
+
}
|
|
193
|
+
/** Adds the spec's closest paths to the message of a page-not-found error, when the spec is available. */
|
|
194
|
+
async function addClosestPaths(error, normalizedPath, signal) {
|
|
195
|
+
const index = await fetchApiOperationIndexIfAvailable(signal);
|
|
196
|
+
const paths = index ? findClosestApiPaths(index, normalizedPath) : [];
|
|
197
|
+
if (paths.length === 0)
|
|
198
|
+
return;
|
|
199
|
+
error.message = `${error.message.replace(/([^.!?])$/, '$1.')} The closest paths in the API spec: ${paths.join(', ')}`;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* A copy of a response body with the session's token replaced, since a response can echo it, as
|
|
203
|
+
* `GET /v2/browser-info` echoes the request headers. A binary body is masked too: apify-client copies a
|
|
204
|
+
* Buffer error body into the message.
|
|
205
|
+
*/
|
|
206
|
+
function maskToken(data, token) {
|
|
207
|
+
if (!token || data === undefined)
|
|
208
|
+
return data;
|
|
209
|
+
if (Buffer.isBuffer(data)) {
|
|
210
|
+
// The token is ASCII, so a latin1 round trip keeps every other byte as it is.
|
|
211
|
+
const bytes = data.toString('latin1');
|
|
212
|
+
return bytes.includes(token) ? Buffer.from(bytes.replaceAll(token, REDACTED), 'latin1') : data;
|
|
213
|
+
}
|
|
214
|
+
const text = JSON.stringify(data);
|
|
215
|
+
// The token as it appears inside a JSON string.
|
|
216
|
+
const escapedToken = JSON.stringify(token).slice(1, -1);
|
|
217
|
+
return text.includes(escapedToken) ? JSON.parse(text.replaceAll(escapedToken, REDACTED)) : data;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* The request failure as a plain error with only its message and code: the axios error holds the
|
|
221
|
+
* Authorization header and the request body, and the tool error log prints the whole error.
|
|
222
|
+
*/
|
|
223
|
+
function toPlainRequestError(error) {
|
|
224
|
+
if (!(error instanceof Error))
|
|
225
|
+
return new Error(String(error));
|
|
226
|
+
const { code } = error;
|
|
227
|
+
return Object.assign(new Error(error.message), typeof code === 'string' ? { code } : {});
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Sends one request to an API path and returns the response body, like `apify api` in the Apify CLI.
|
|
231
|
+
* The URL is the client's base URL and the normalized path, not encoded again, with `query` added.
|
|
232
|
+
* It sends with `sendApifyApiRequest` (one attempt, body capped at `MAX_INLINE_BYTES`) and throws a
|
|
233
|
+
* non-2xx response as apify-client's `ApifyApiError`, so it gets the usual tool error text and telemetry.
|
|
234
|
+
*/
|
|
235
|
+
export async function callApi(params) {
|
|
236
|
+
var _a;
|
|
237
|
+
const { client, method } = params;
|
|
238
|
+
const normalizedPath = normalizeApiPath(params.path);
|
|
239
|
+
const path = formatApiPath(normalizedPath);
|
|
240
|
+
// `client.baseUrl` already ends with /v2.
|
|
241
|
+
const url = `${client.baseUrl}/${normalizedPath}`;
|
|
242
|
+
// An assertion: nothing after the base URL can change the host that gets the token.
|
|
243
|
+
if (!isApifyApiUri(url))
|
|
244
|
+
throw new Error(`The URL ${url} is not on the API host.`);
|
|
245
|
+
let response;
|
|
246
|
+
try {
|
|
247
|
+
response = await sendApifyApiRequest(client, { url, method, params: params.query, signal: params.signal });
|
|
248
|
+
}
|
|
249
|
+
catch (error) {
|
|
250
|
+
// A cancelled call is not a tool error.
|
|
251
|
+
if ((_a = params.signal) === null || _a === void 0 ? void 0 : _a.aborted)
|
|
252
|
+
return respondAborted();
|
|
253
|
+
if (isMaxContentLengthAbort(error)) {
|
|
254
|
+
return respondUserError(await formatOversizeMessage({
|
|
255
|
+
method,
|
|
256
|
+
normalizedPath,
|
|
257
|
+
loadedToolNames: params.loadedToolNames,
|
|
258
|
+
signal: params.signal,
|
|
259
|
+
}));
|
|
260
|
+
}
|
|
261
|
+
throw toPlainRequestError(error);
|
|
262
|
+
}
|
|
263
|
+
const data = maskToken(response.data, params.token);
|
|
264
|
+
if (response.status >= 300) {
|
|
265
|
+
// Without the query in the path: apify-client puts the URL into the error, and a 5xx error is logged.
|
|
266
|
+
const error = new ApifyApiError({ ...response, data, config: { ...response.config, url: stripQuery(url) } }, 1);
|
|
267
|
+
if (error.type === APIFY_ERROR_TYPE_PAGE_NOT_FOUND)
|
|
268
|
+
await addClosestPaths(error, normalizedPath, params.signal);
|
|
269
|
+
throw error;
|
|
270
|
+
}
|
|
271
|
+
const contentTypeHeader = response.headers['content-type'];
|
|
272
|
+
const contentType = typeof contentTypeHeader === 'string' ? contentTypeHeader : undefined;
|
|
273
|
+
// apify-client parses JSON and text bodies; a binary body stays a Buffer and is not returned.
|
|
274
|
+
const isBinary = Buffer.isBuffer(data);
|
|
275
|
+
const structuredContent = {
|
|
276
|
+
method,
|
|
277
|
+
path,
|
|
278
|
+
statusCode: response.status,
|
|
279
|
+
...(contentType && { contentType }),
|
|
280
|
+
data: isBinary || data === undefined ? null : data,
|
|
281
|
+
};
|
|
282
|
+
const summary = isBinary
|
|
283
|
+
? `${method} ${path} returned HTTP ${response.status} with a binary body ` +
|
|
284
|
+
`(${contentType !== null && contentType !== void 0 ? contentType : 'no Content-Type'}, ${data.length} bytes), which is not shown.`
|
|
285
|
+
: `${method} ${path} returned HTTP ${response.status}.`;
|
|
286
|
+
return respondOk([JSON.stringify(structuredContent), summary], { structuredContent });
|
|
287
|
+
}
|
|
288
|
+
//# sourceMappingURL=apify_api_request.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apify_api_request.js","sourceRoot":"","sources":["../../../src/tools/api/apify_api_request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,IAAI,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAE3D,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,E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