openalmanac 0.2.15 → 0.2.17

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/dist/server.js CHANGED
@@ -48,9 +48,9 @@ export function createServer() {
48
48
  "create_stub with the image_url from the ![Profile Photo](url) line in the scraped markdown. " +
49
49
  "For topics/orgs/events: use descriptive kebab-case slugs (e.g. 'reinforcement-learning', 'openai').\n\n" +
50
50
  "## Images\n\n" +
51
- "Use search_images to find images for articles. Syntax: `![Caption](url \"position\")` where position " +
52
- "is 'right' (default), 'left', or 'center'. The caption (alt text) is displayed below the image — " +
53
- "make it descriptive. Use 1-3 images per major section. " +
51
+ "Use search_images to find images, then view_image to verify candidates before using them. " +
52
+ "Syntax: `![Caption](url \"position\")` where position is 'right' (default), 'left', or 'center'. " +
53
+ "The caption (alt text) is displayed below the image — make it descriptive. Use 1-3 images per major section. " +
54
54
  "For the infobox hero image, set infobox.header.image_url in frontmatter. " +
55
55
  "External image URLs are auto-persisted on push — no extra steps needed.\n\n" +
56
56
  "After creating an article, always share the exact URL from the push response with the user. " +
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import { imageContent } from "fastmcp";
2
3
  import { request } from "../auth.js";
3
4
  export function registerResearchTools(server) {
4
5
  server.addTool({
@@ -44,7 +45,7 @@ export function registerResearchTools(server) {
44
45
  name: "search_images",
45
46
  description: "Search for images to include in articles. Returns image URLs, titles, dimensions, and licensing info. " +
46
47
  "Two sources: 'wikimedia' (free, open-licensed images from Wikimedia Commons — preferred) and 'google' (broader web images via Google). " +
47
- "Use descriptive search terms. Pick images based on their title and description. " +
48
+ "Use descriptive search terms. After searching, call view_image on promising candidates to see what they actually show before using them. " +
48
49
  "External image URLs are automatically persisted when you push the article — no extra steps needed.\n\n" +
49
50
  "## Using images in articles\n\n" +
50
51
  "Images render as figures with visible captions. The alt text becomes the caption — make it descriptive.\n\n" +
@@ -81,4 +82,25 @@ export function registerResearchTools(server) {
81
82
  return JSON.stringify(await resp.json(), null, 2);
82
83
  },
83
84
  });
85
+ server.addTool({
86
+ name: "view_image",
87
+ description: "View an image to verify it's suitable for an article. Use after search_images to inspect candidate images " +
88
+ "before including them. Returns the image so you can see what it actually shows and write an accurate caption.",
89
+ parameters: z.object({
90
+ url: z.string().url().describe("Image URL to view (use image_url or thumbnail_url from search_images results)"),
91
+ }),
92
+ async execute({ url }) {
93
+ try {
94
+ return {
95
+ content: [
96
+ await imageContent({ url }),
97
+ { type: "text", text: `Image URL: ${url}` },
98
+ ],
99
+ };
100
+ }
101
+ catch {
102
+ return `Failed to fetch image from ${url}. The URL may be invalid, inaccessible, or not an image.`;
103
+ }
104
+ },
105
+ });
84
106
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openalmanac",
3
- "version": "0.2.15",
3
+ "version": "0.2.17",
4
4
  "description": "OpenAlmanac — pull, edit, and push articles to the open knowledge base",
5
5
  "type": "module",
6
6
  "bin": {