afpnews-mcp-server 1.3.1 → 1.3.3

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.
@@ -20,11 +20,11 @@ Returns:
20
20
  Examples:
21
21
  - Find similar articles in French: { uno: "NEWS-FR-123456-ABC", lang: "fr" }
22
22
  - Get 5 similar English articles: { uno: "NEWS-EN-789", lang: "en", size: 5 }`,
23
- inputSchema: {
23
+ inputSchema: z.object({
24
24
  uno: z.string().describe('The UNO of the reference article'),
25
25
  lang: langEnum.describe("Language for results (e.g. 'en', 'fr')"),
26
26
  size: z.number().optional().describe('Number of similar articles to return (default 10)'),
27
- },
27
+ }),
28
28
  handler: async (apicore, { uno, lang, size }) => {
29
29
  try {
30
30
  const { documents, count } = await apicore.mlt(uno, lang, size);
@@ -17,9 +17,9 @@ Returns:
17
17
 
18
18
  Examples:
19
19
  - Get a specific article: { uno: "NEWS-FR-123456-ABC" }`,
20
- inputSchema: {
20
+ inputSchema: z.object({
21
21
  uno: z.string().describe('The unique identifier (UNO) of the article'),
22
- },
22
+ }),
23
23
  handler: async (apicore, { uno }) => {
24
24
  try {
25
25
  const doc = await apicore.get(uno);
@@ -1,16 +1,21 @@
1
+ import { zodToJsonSchema } from 'zod-to-json-schema';
1
2
  import { afpSearchArticlesTool } from './search-articles.js';
2
3
  import { afpGetArticleTool } from './get-article.js';
3
4
  import { afpFindSimilarTool } from './find-similar.js';
4
5
  import { afpListFacetsTool } from './list-facets.js';
5
6
  import { READ_ONLY_ANNOTATIONS } from './shared.js';
6
- export const TOOL_DEFINITIONS = [
7
+ const RAW_TOOLS = [
7
8
  afpSearchArticlesTool,
8
9
  afpGetArticleTool,
9
10
  afpFindSimilarTool,
10
11
  afpListFacetsTool,
11
12
  ];
13
+ export const TOOL_DEFINITIONS = RAW_TOOLS.map((t) => ({
14
+ ...t,
15
+ inputJsonSchema: zodToJsonSchema(t.inputSchema, { target: 'openApi3' }),
16
+ }));
12
17
  export function registerTools(ctx) {
13
- for (const tool of TOOL_DEFINITIONS) {
18
+ for (const tool of RAW_TOOLS) {
14
19
  ctx.server.registerTool(tool.name, {
15
20
  title: tool.title,
16
21
  description: tool.description,
@@ -23,12 +23,12 @@ Examples:
23
23
  - Trending topics in English: { preset: "trending-topics", lang: "en" }
24
24
  - List available genres: { facet: "genre" }
25
25
  - List countries: { facet: "country", size: 30 }`,
26
- inputSchema: {
26
+ inputSchema: z.object({
27
27
  preset: listPresetEnum.optional().describe('Optional preset for list queries. Available preset: trending-topics.'),
28
28
  facet: z.string().optional().describe("Facet to list (e.g. 'slug', 'genre', 'country'). Required when no preset is used."),
29
29
  lang: langEnum.optional().describe("Language filter (e.g. 'en', 'fr')"),
30
30
  size: z.number().optional().describe('Number of facet values to return'),
31
- },
31
+ }),
32
32
  handler: async (apicore, { preset, facet, lang, size }) => {
33
33
  try {
34
34
  const isTrendingTopics = preset === 'trending-topics';
@@ -31,7 +31,7 @@ Examples:
31
31
  - French front page: { preset: "a-la-une" }
32
32
  - Recent photos: { product: ["photo"], lang: ["en"], size: 5 }
33
33
  - Page 2 of results: { query: "economy", size: 10, offset: 10 }`,
34
- inputSchema: {
34
+ inputSchema: z.object({
35
35
  preset: searchPresetEnum.optional().describe('Optional preset that applies predefined AFP filters. Available presets: a-la-une, agenda, previsions, major-stories.'),
36
36
  fullText: z.boolean().optional().describe('When true, returns the full article body. Default is false. If omitted and a preset is used, fullText defaults to true.'),
37
37
  query: z.string().optional().describe("List of keywords to search for in the news articles (e.g. 'climate change'), in the language specified by the 'lang' parameter. If not specified, the search will be performed in all languages. Do not use keywords in multiple languages."),
@@ -44,7 +44,7 @@ Examples:
44
44
  country: z.string().array().optional().describe("Country filter (e.g. 'fra', 'usa')"),
45
45
  slug: z.string().array().optional().describe("Topic/slug filter (e.g. 'economy', 'sports')"),
46
46
  product: z.enum(['news', 'factcheck', 'photo', 'video', 'multimedia', 'graphic', 'videographic']).array().optional().describe("Content type filter (default ['news', 'factcheck'])"),
47
- },
47
+ }),
48
48
  handler: async (apicore, { preset, fullText = false, query, lang, dateFrom, dateTo, size = DEFAULT_SEARCH_SIZE, sortOrder = 'desc', offset, country, slug, product = ['news', 'factcheck'] }) => {
49
49
  try {
50
50
  let request = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "afpnews-mcp-server",
3
- "version": "1.3.1",
3
+ "version": "1.3.3",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "type": "module",
@@ -28,7 +28,8 @@
28
28
  "afpnews-api": "^2.4.0",
29
29
  "dotenv": "^17.3.1",
30
30
  "express": "^5.2.1",
31
- "zod": "^4.3.6"
31
+ "zod": "^4.3.6",
32
+ "zod-to-json-schema": "^3.25.1"
32
33
  },
33
34
  "devDependencies": {
34
35
  "@types/express": "^5.0.6",