You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: structured output for the crucial tools (#349)
* feat: add structured output to the crucial tools
* refactor: extract shared output schemas to reduce duplication
Extract duplicate JSON schema definitions from fetch-actor-details and
store-search tools into a centralized src/tools/schemas.ts module. This
eliminates ~170 lines of duplicated code while making schemas easier to
maintain and reuse across tools.
Schemas extracted:
- developerSchema
- pricingSchema
- statsSchema
- actorInfoSchema (reused by both tools)
- actorDetailsOutputSchema
- actorSearchOutputSchema
* fix: remove incorrect 1000x multiplication in pricing values
Remove the multiplication by 1000 in pricingInfoToStructured for PRICE_PER_DATASET_ITEM
model. The pricePerUnit field now correctly represents the actual price per unit,
making the naming consistent and accurate across all pricing models.
Also add JSDoc clarifying that the function transforms API response to match
unstructured text output format for consistency.
* refactor: extract test validation logic to reduce duplication across structured output tests
* fix typo
* fix: links in README.md
* Update src/tools/schemas.ts
Co-authored-by: Jiří Spilka <[email protected]>
* Update src/tools/schemas.ts
Co-authored-by: Jiří Spilka <[email protected]>
* Update src/tools/schemas.ts
Co-authored-by: Jiří Spilka <[email protected]>
* Update src/tools/schemas.ts
Co-authored-by: Jiří Spilka <[email protected]>
* Update src/tools/schemas.ts
Co-authored-by: Jiří Spilka <[email protected]>
* Update src/tools/schemas.ts
Co-authored-by: Jiří Spilka <[email protected]>
* Update src/tools/schemas.ts
Co-authored-by: Jiří Spilka <[email protected]>
* address review comments
* fix build
---------
Co-authored-by: Jiri Spilka <[email protected]>
Co-authored-by: Jiří Spilka <[email protected]>
texts: [`No results found for the query "${query}" with limit ${parsed.limit} and offset ${parsed.offset}.
71
+
returnbuildMCPResponse({texts: [`No results found for the query "${query}" with limit ${parsed.limit} and offset ${parsed.offset}.
71
72
Please try a different query with different keywords, or adjust the limit and offset parameters.
72
-
You can also try using more specific or alternative keywords related to your search topic.`],
73
-
});
73
+
You can also try using more specific or alternative keywords related to your search topic.`]});
74
74
}
75
75
76
76
consttextContent=`You can use the Apify docs fetch tool to retrieve the full content of a document by its URL. The document fragment refers to the section of the content containing the relevant part for the search result item.
texts: [`No Actors were found for the search query "${parsed.keywords}".
149
-
Please try different keywords or simplify your query. Consider using more specific platform names (e.g., "Instagram", "Twitter") and data types (e.g., "posts", "products") rather than generic terms like "scraper" or "crawler".`],
150
-
});
149
+
returnbuildMCPResponse({texts: [`No Actors were found for the search query "${parsed.keywords}".
150
+
Please try different keywords or simplify your query. Consider using more specific platform names (e.g., "Instagram", "Twitter") and data types (e.g., "posts", "products") rather than generic terms like "scraper" or "crawler".`]});
151
151
}
152
152
153
153
constactorsText=actorCards.join('\n\n');
154
154
155
-
returnbuildMCPResponse({texts: [`
156
-
# Search results:
157
-
- **Search query:** ${parsed.keywords}
158
-
- **Number of Actors found:** ${actorCards.length}
- **Number of Actors found:** ${actorCards.length}
161
162
162
-
${actorsText}
163
+
# Actors:
163
164
164
-
If you need more detailed information about any of these Actors, including their input schemas and usage instructions, please use the ${HelperTools.ACTOR_GET_DETAILS} tool with the specific Actor name.
165
-
If the search did not return relevant results, consider refining your keywords, use broader terms or removing less important words from the keywords.
166
-
`]});
165
+
${actorsText}
166
+
167
+
If you need more detailed information about any of these Actors, including their input schemas and usage instructions, please use the ${HelperTools.ACTOR_GET_DETAILS} tool with the specific Actor name.
168
+
If the search did not return relevant results, consider refining your keywords, use broader terms or removing less important words from the keywords.
0 commit comments