Skip to content

Add outputSchema support to fix MCP tool validation errors#19

Draft
Copilot wants to merge 4 commits intomainfrom
copilot/fix-application-create-schema-error
Draft

Add outputSchema support to fix MCP tool validation errors#19
Copilot wants to merge 4 commits intomainfrom
copilot/fix-application-create-schema-error

Conversation

Copy link

Copilot AI commented Feb 3, 2026

The MCP SDK validates tool responses against outputSchema when defined. The application-create tool was failing with "data should NOT have additional properties" because the server used the deprecated tool() method which lacks outputSchema support.

Changes

  • Tool infrastructure: Added optional outputSchema field to ToolDefinition<TShape, TOutputShape> interface
  • Server registration: Migrated from deprecated tool() to registerTool() method with proper schema configuration
  • application-create handler: Returns both content (text) and structuredContent (validated object) matching the defined output schema

Example

Before:

server.tool(tool.name, tool.description, tool.schema.shape, tool.handler);

After:

export const applicationCreate = createTool({
  name: "application-create",
  outputSchema: z.object({
    success: z.boolean(),
    message: z.string(),
    data: z.record(z.any()).optional()
  }),
  handler: async (input) => {
    const structuredData = { success: true, message: "...", data: response.data };
    return {
      content: [{ type: "text", text: JSON.stringify(structuredData, null, 2) }],
      structuredContent: structuredData  // SDK validates this against outputSchema
    };
  }
});

The outputSchema remains optional for backward compatibility with existing tools.

Original prompt

This section details on the original issue you should resolve

<issue_title>application-create returns response with additional properties not in output schema</issue_title>
<issue_description>## Description

The application-create tool fails with a schema validation error when creating a new application. The API call appears to succeed, but the response contains additional properties that are not defined in the tool's output schema.

Error Message

MCP error -32602: Structured content does not match the tool's output schema: data should NOT have additional properties

Reproduction Steps

  1. Configure Dokploy MCP server in Cursor IDE
  2. Call application-create with valid parameters:
    {
      "name": "TestApp",
      "environmentId": "<valid-environment-id>"
    }
  3. The API call succeeds but returns an error due to schema mismatch

Environment

  • MCP Client: Cursor IDE
  • Dokploy: Cloud version (app.dokploy.com)
  • Package: @ahdev/dokploy-mcp (latest via npx)

Expected Behavior

The application-create tool should successfully create an application and return a valid response that matches the defined output schema.

Actual Behavior

The tool returns an MCP error indicating the response has additional properties not defined in the output schema. This suggests the Dokploy API returns more fields than the MCP tool's output schema allows.

Suggested Fix

Update the output schema for application-create to include all properties returned by the Dokploy API, or use "additionalProperties": true in the schema definition.

Workaround

Create applications manually via the Dokploy UI. Other tools like project-all, project-update, application-one, application-deploy, etc. work correctly.
</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits February 3, 2026 16:16
Co-authored-by: Siumauricio <47042324+Siumauricio@users.noreply.github.com>
Co-authored-by: Siumauricio <47042324+Siumauricio@users.noreply.github.com>
Co-authored-by: Siumauricio <47042324+Siumauricio@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix application-create response schema validation error Add outputSchema support to fix MCP tool validation errors Feb 3, 2026
Copilot AI requested a review from Siumauricio February 3, 2026 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

application-create returns response with additional properties not in output schema

2 participants