paramDefToSchema (mcp/tool-defs.ts)

gbrain · src/mcp/tool-defs.ts · typescript · MIT
integration

Converts operation parameter definitions into JSON Schema fragments for MCP tools.

// Source: https://github.com/garrytan/gbrain | License: MIT | Copyright 2026 Garry Tan
// Provided via justclaw.it.com; keep this notice with the code.
import type { OperationMeta, ParamDef } from '../core/ops/contract.ts';

export interface McpToolDef {
  name: string;
  description: string;
  inputSchema: {
    type: 'object';
    properties: Record<string, unknown>;
    required: string[];
    /** WP3 (D14.1): emitted ONLY when buildToolDefs runs with strictParams. */
    additionalProperties?: false;
  };
  /**
   * MCP ToolAnnotations (SDK 1.29+): the op's own curated annotations, else
   * the conservative derivation in toolAnnotations(). Absent when neither
   * applies, so an op of unknown effect stays unannotated.
   */
  annotations?: {
    title?: string;
    readOnlyHint?: boo

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key