Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

671 B
Raw Blame
import { defineCommand } from '@/core/command'
import { findTool } from '@/posthog/api-tools'

export default defineCommand({
    description: "Print an API tool's input schema, or one field of it",
    args: {
        tool: { description: 'The tool name, as `hog api tools` lists it' },
        field: { description: 'A dotted path to a nested field, like filters.groups', optional: true },
    },
    examples: ['hog api schema feature-flag-get-all', 'hog api schema create-feature-flag filters.groups'],

    async run({ args, ctx }) {
        const library = await ctx.apiTools()
        return library.schema(findTool(library, args.tool).name, args.field)
    },
})