Skip to content

Commit ea0f845

Browse files
committed
fix: handle review comments
1 parent 4ccb4f6 commit ea0f845

File tree

4 files changed

+16
-25
lines changed

4 files changed

+16
-25
lines changed

src/tools/actor.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ EXAMPLES:
405405
}
406406
const toolsResponse = await client.listTools();
407407

408-
const toolsInfo = toolsResponse.tools.map((tool) => `**${tool.name}**\n${tool.description || 'No description'}\nInput Schema: ${JSON.stringify(tool.inputSchema, null, 2)}`,
408+
const toolsInfo = toolsResponse.tools.map((tool) => `**${tool.name}**\n${tool.description || 'No description'}\nInput schema: ${JSON.stringify(tool.inputSchema, null, 2)}`,
409409
).join('\n\n');
410410

411411
return buildMCPResponse([`This is an MCP Server Actor with the following tools:\n\n${toolsInfo}\n\nTo call a tool, use step="call" with actor name format: "${baseActorName}:{toolName}"`]);
@@ -420,7 +420,7 @@ EXAMPLES:
420420
}
421421
const content = [
422422
// TODO: update result to say: this is result of info step, you must now call again with step=call and proper input
423-
{ type: 'text', text: `# Input Schema: \n${JSON.stringify(details.inputSchema, null, 0)}` },
423+
{ type: 'text', text: `Input schema: \n${JSON.stringify(details.inputSchema, null, 0)}` },
424424
];
425425
/**
426426
* Add Skyfire instructions also in the info step since clients are most likely truncating the long tool description of the call-actor.
@@ -499,7 +499,7 @@ EXAMPLES:
499499
if (errors && errors.length > 0) {
500500
return buildMCPResponse([
501501
`Input validation failed for Actor '${actorName}': ${errors.map((e) => e.message).join(', ')}`,
502-
`Input Schema:\n${JSON.stringify(actor.tool.inputSchema)}`,
502+
`Input schema:\n${JSON.stringify(actor.tool.inputSchema)}`,
503503
]);
504504
}
505505
}

src/tools/store_collection.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import zodToJsonSchema from 'zod-to-json-schema';
55
import { ApifyClient } from '../apify-client.js';
66
import { ACTOR_SEARCH_ABOVE_LIMIT, HelperTools } from '../const.js';
77
import type { ActorPricingModel, ExtendedActorStoreList, HelperTool, ToolEntry } from '../types.js';
8-
import { formatActorsListToActorCard } from '../utils/actor-card.js';
8+
import { formatActorToActorCard } from '../utils/actor-card.js';
99
import { ajv } from '../utils/ajv.js';
1010

1111
export async function searchActorsByKeywords(
@@ -99,7 +99,12 @@ USAGE EXAMPLES:
9999
parsed.offset,
100100
);
101101
actors = filterRentalActors(actors || [], userRentedActorIds || []).slice(0, parsed.limit);
102-
const actorCards = formatActorsListToActorCard(actors);
102+
const actorCards = actors.length === 0 ? [] : actors.map(formatActorToActorCard);
103+
104+
const actorsText = actorCards.length
105+
? actorCards.join('\n\n')
106+
: 'No Actors were found for the given search query. Please try different keywords or simplify your query.';
107+
103108
return {
104109
content: [
105110
{
@@ -111,7 +116,7 @@ USAGE EXAMPLES:
111116
112117
# Actors:
113118
114-
${actorCards.join('\n\n')}`,
119+
${actorsText}`,
115120
},
116121
],
117122
};

src/utils/actor-card.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -102,17 +102,3 @@ export function formatActorToActorCard(
102102
}
103103
return markdownLines.join('\n');
104104
}
105-
106-
/**
107-
* Formats a list of Actors into Actor cards
108-
* @param actors - Array of Actor information
109-
* @returns Formatted markdown string
110-
*/
111-
export function formatActorsListToActorCard(actors: (Actor | ExtendedActorStoreList)[]): string[] {
112-
if (actors.length === 0) {
113-
return [];
114-
}
115-
return actors.map((actor) => {
116-
return formatActorToActorCard(actor);
117-
});
118-
}

src/utils/pricing-info.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ function convertMinutesToGreatestUnit(minutes: number): { value: number; unit: s
5555
*/
5656

5757
function payPerEventPricingToString(pricingPerEvent: ExtendedPricingInfo['pricingPerEvent']): string {
58-
if (!pricingPerEvent || !pricingPerEvent.actorChargeEvents) return 'No event pricing information available.';
58+
if (!pricingPerEvent || !pricingPerEvent.actorChargeEvents) return 'Pricing information for events is not available.';
5959
const eventStrings: string[] = [];
6060
for (const event of Object.values(pricingPerEvent.actorChargeEvents)) {
6161
let eventStr = `\t- **${event.eventTitle}**: ${event.eventDescription} `;
@@ -78,7 +78,7 @@ export function pricingInfoToString(pricingInfo: ExtendedPricingInfo | null): st
7878
// If there is no pricing infos entries the Actor is free to use
7979
// based on https://github.com/apify/apify-core/blob/058044945f242387dde2422b8f1bef395110a1bf/src/packages/actor/src/paid_actors/paid_actors_common.ts#L691
8080
if (pricingInfo === null || pricingInfo.pricingModel === ACTOR_PRICING_MODEL.FREE) {
81-
return 'User pays for the computing resources consumed by the Actor';
81+
return 'This Actor is free to use. You are only charged for Apify platform usage.';
8282
}
8383
if (pricingInfo.pricingModel === ACTOR_PRICING_MODEL.PRICE_PER_DATASET_ITEM) {
8484
const customUnitName = pricingInfo.unitName !== 'result' ? pricingInfo.unitName : '';
@@ -98,12 +98,12 @@ export function pricingInfoToString(pricingInfo: ExtendedPricingInfo | null): st
9898
const tiers = Object.entries(pricingInfo.tieredPricing)
9999
.map(([tier, obj]) => `${tier}: $${obj.tieredPricePerUnitUsd} per month`)
100100
.join(', ');
101-
return `This Actor is rental and thus has tiered pricing per month: ${tiers}, with a trial period of ${value} ${unit}.`;
101+
return `This Actor is rental and has tiered pricing per month: ${tiers}, with a trial period of ${value} ${unit}.`;
102102
}
103-
return `This Actor is rental and thus has a flat price of ${pricingInfo.pricePerUnitUsd} USD per month, with a trial period of ${value} ${unit}.`;
103+
return `This Actor is rental and has a flat price of ${pricingInfo.pricePerUnitUsd} USD per month, with a trial period of ${value} ${unit}.`;
104104
}
105105
if (pricingInfo.pricingModel === ACTOR_PRICING_MODEL.PAY_PER_EVENT) {
106106
return payPerEventPricingToString(pricingInfo.pricingPerEvent);
107107
}
108-
return 'Not available';
108+
return 'Pricing information is not available.';
109109
}

0 commit comments

Comments
 (0)