Files
editor/packages/mcp/src/tools/vision/index.ts
T
Adrian PerezandClaude Opus 4.7 4dbfbb1e1a 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>
2026-04-18 17:51:22 +02:00

27 lines
959 B
TypeScript

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'