feat(mcp): add multimodal vision tools via MCP sampling

analyze_floorplan_image and analyze_room_photo defer the vision work
to the host via MCP sampling (server.server.createMessage). Validates
host capability before calling, fetches URL inputs and base64-encodes
them, constrains output to a Zod schema, and returns structured
content. No vision model is bundled.

9 tests, all passing via a mocked sampling-capable client.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Adrian Perez
2026-04-18 17:51:22 +02:00
co-authored by Claude Opus 4.7
parent 570c605446
commit 4dbfbb1e1a
5 changed files with 715 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
import type { SceneBridge } from '../../bridge/scene-bridge'
import { registerAnalyzeFloorplanImage } from './analyze-floorplan-image'
import { registerAnalyzeRoomPhoto } from './analyze-room-photo'
/**
* Register the vision-input tools that defer to the MCP host's sampling
* capability. No vision model is bundled in this package — if the host does
* not advertise `sampling` support, calling either tool returns
* `sampling_unavailable`.
*/
export function registerVisionTools(server: McpServer, bridge: SceneBridge): void {
registerAnalyzeFloorplanImage(server, bridge)
registerAnalyzeRoomPhoto(server, bridge)
}
export {
analyzeFloorplanImageInput,
analyzeFloorplanImageOutput,
registerAnalyzeFloorplanImage,
} from './analyze-floorplan-image'
export {
analyzeRoomPhotoInput,
analyzeRoomPhotoOutput,
registerAnalyzeRoomPhoto,
} from './analyze-room-photo'