chore: steer towards mcp types a bit (#880)

This commit is contained in:
Pavel Feldman
2025-08-13 14:09:37 -07:00
committed by GitHub
parent 8572ab300c
commit 73adb0fdf0
10 changed files with 87 additions and 141 deletions

View File

@@ -22,7 +22,7 @@ import type * as playwright from 'playwright';
import type { ToolCapability } from '../../config.js';
import type { Tab } from '../tab.js';
import type { Response } from '../response.js';
import type { ToolDefinition } from '../mcp/server.js';
import type * as mcpServer from '../mcp/server.js';
export type FileUploadModalState = {
type: 'fileChooser';
@@ -46,11 +46,11 @@ export type ToolSchema<Input extends z.Schema> = {
type: 'readOnly' | 'destructive';
};
export function toToolDefinition(tool: ToolSchema<any>): ToolDefinition {
export function toMcpTool(tool: ToolSchema<any>): mcpServer.Tool {
return {
name: tool.name,
description: tool.description,
inputSchema: zodToJsonSchema(tool.inputSchema, { strictUnions: true }) as ToolDefinition['inputSchema'],
inputSchema: zodToJsonSchema(tool.inputSchema, { strictUnions: true }) as mcpServer.Tool['inputSchema'],
annotations: {
title: tool.title,
readOnlyHint: tool.type === 'readOnly',