ExMCP.DSL.Meta (ex_mcp v0.9.2)

View Source

Shared metadata DSL for Tools, Resources, and Prompts.

Provides a consistent meta block syntax across all DSL types:

deftool "say_hello" do
  meta do
    name "Hello Tool"
    description "Says hello to someone"
    version "1.0.0"
  end

  input_schema %{...}
end

defresource "config://app" do
  meta do
    name "App Config"
    description "Application configuration"
  end

  mime_type "application/json"
end

defprompt "greeting" do
  meta do
    name "Greeting Template"
    description "A greeting template"
  end

  arguments do
    arg :style, description: "Greeting style"
  end
end

Summary

Functions

Sets the author for the current DSL element.

Clears all metadata attributes for the current DSL element.

Sets the description for the current DSL element.

Retrieves all accumulated metadata for the current DSL element.

Defines a metadata block for DSL elements.

Sets the name for the current DSL element.

Sets tags for the current DSL element.

Validates that required metadata fields are present.

Sets the version for the current DSL element.

Functions

author(value)

(macro)

Sets the author for the current DSL element.

clear_meta(module)

Clears all metadata attributes for the current DSL element.

Should be called before processing each new DSL element.

description(value)

(macro)

Sets the description for the current DSL element.

get_meta(module)

Retrieves all accumulated metadata for the current DSL element.

Returns a map with all the metadata fields that have been set.

meta(list)

(macro)

Defines a metadata block for DSL elements.

The meta block accumulates metadata using module attributes and validates required fields.

name(value)

(macro)

Sets the name for the current DSL element.

tags(value)

(macro)

Sets tags for the current DSL element.

validate_meta!(element_type, element_id, meta, opts \\ [])

Validates that required metadata fields are present.

Options

  • :require_name - Requires name field (default: true)
  • :require_description - Requires description field (default: true)

version(value)

(macro)

Sets the version for the current DSL element.