feat(cli): add validate command for static linting of tool, resource, and prompt files#560
feat(cli): add validate command for static linting of tool, resource, and prompt files#560lzvxck wants to merge 3 commits into
Conversation
|
@lioarce01 is attempting to deploy a commit to the xmcp Team on Vercel. A member of the Team first needs to authorize it. |
Omitting metadata is valid cause we default it on the framework. Why would we error on that?
some tools don't need schemas and this only creates friction and incorrect warnings. Overall I don't feel we need this custom validate script. We could be leveraging the failing of build into running a couple checks to prevent the server from crashing, like validating there's a default export with the handler (*the only required export) |
|
Thanks for the review, you're right on all counts. On metadata: agreed, removing that as an error. Flagging it as an error was wrong. On schema: agreed. The framework defaults missing schema to {} and registers the tool with z.object({}), fully valid. Warning on every schemaless tool is friction without signal. On the broader question: you're right, a custom validate script adds unnecessary complexity. I'll drop it and instead hook the export default check directly into the build step, so the server is protected from crashing without needing a separate command. I'll open a follow-up PR for that. Thanks again for the direction. |
Summary
Adds
xmcp validate, a CLI command that statically analyzes tool, resource, and prompt files for common structural issues before building or deploying.Checks performed:
export default(handler is required by the runtime)export const metadata(tool is undiscoverable without it)export const schema(tools only; empty schema is valid but worth surfacing)"TODO: Add description"left fromxmcp create)Exits with code
1when errors are present,0for warnings-only — safe to run in CI. Readsxmcp.config.json/tsfor directory paths;--tools,--resources, and--promptsflags override them per-run.Also fixes two incomplete tool files in the
http-transportexample that were missingmetadata, and adds avalidatescript to itspackage.json.Type of Change
Affected Packages
xmcp(core framework)create-xmcp-appinit-xmcpScreenshots/Examples
Running against the
http-transportexample:The three warnings are intentional — those tools take no input parameters, so omitting
schemais valid. The command exits0since there are no errors.Usage:
Related Issues