Custom tools should follow the same contract as built-in MCP servers: define a JSON-schema parameter contract, execute on the server, return structured JSON, and let the shared tool-call path handle allow-list checks, audit logging, timeouts, and ownership verification.

Tool Definition Schema

Kommander tool definitions use a TypeScript interface equivalent to this shape:

MCP tool schema

Use short, factual descriptions. Avoid instructions such as “ignore previous messages” or text that looks like secrets. For customer-data connectors, OpenAPI descriptions are sanitized before exposure, but native tools should still be written as if the description will be visible to an untrusted model.

Minimal Server

Each server implements IMCPServer. The registry owns initialization, lookup, timeout wrapping, and result status normalization.

Minimal MCP server

Registration

Register the server type once during MCP initialization, then return configs from environment or settings.

Register a server type
Server config shape

The type must match the registered server type. The id identifies the server instance cached for a user.

Customer-Data Connector Tools

For data that belongs to an authenticated end user, prefer an OpenAPI customer-data connector instead of a hand-written tool. The registry converts enabled OpenAPI operations into MCP tool definitions and records connector metadata with each call.

OpenAPI connector registration

Result Ownership

When returning user-owned records, include at least one ownership marker such as userId, user_id, ownerId, endUserId, customerUserId, or the same fields nested under user, owner, endUser, customer, account, or profile.

Ownership-aware result

The marker must match one of the verified identity values. If a mismatch is detected, the tool result becomes an empty successful object or array and an ownership failure audit event is written. The implementation guidance is maintained in docs/mcp-tool-ownership.md.

Authoring Checklist

  • Use unique, stable tool names.
  • Keep descriptions factual and free of instructions.
  • Define complete JSON schemas with required fields.
  • Validate arguments inside executeTool before calling external systems.
  • Require context.verifiedUser for user-owned data.
  • Return structured JSON rather than prose.
  • Include ownership markers on user-owned records.
  • Configure sensitiveFields for connector-specific secrets or PII that audit logs must redact.
  • Keep external calls bounded by timeouts and response-size limits.