import { z } from 'zod'
import { useCanvas } from '@opentiny/tiny-engine-meta-register'
const inputSchema = z.object({})
export const getPageSchema = {
name: 'get_page_schema',
title: '获取页面结构',
description:
'Get current editing page schema from the current TinyEngine low-code application. Use this when you need to get current editing page schema from your application.',
inputSchema: inputSchema.shape,
annotations: {
title: '获取页面结构',
readOnlyHint: true,
openWorldHint: false
},
callback: async (_args: z.infer<typeof inputSchema>) => {
const pageSchema = useCanvas().getSchema()
const res = {
status: 'success',
message: `Page schema retrieved successfully`,
data: {
pageSchema
}
}
return {
content: [
{
type: 'text',
text: JSON.stringify(res)
}
]
}
}
}