A2UICore.Functions.MCP (A2UICore v0.1.1)

Copy Markdown View Source

Implementations of the MCP catalog's functions (see A2UICore.Catalog.MCP).

  • callMcpTool calls a tool through the host's A2UICore.MCP.Client and returns the tool's CallToolResult. The A2UI messages the result carries — in the UI resources it names (_meta.ui.resourceUri, else those its tool descriptor declares) and embedded in its content — come back as {:messages, %{messages: messages, source: :resource | :inline}} effects for the renderer to apply; messages without a version get the catalog's (v0.9 or v1.0). With targetDataPath (v1.0), the MCP App a resource holds is written there as %{"uri", "htmlContent", "csp", "permissions", "toolInput", "toolResult"} (a {:write, ...} effect), ready for an McpApp component to bind.
  • jmespath evaluates a JMESPath expression (A2UICore.JMESPath).
  • split, regexCapture and regexReplace work on a string, or on each string of an array. Patterns are RE2 expressions, run by PCRE with RE2's meaning of $ (end of text) and ASCII \d, \w, \b.
  • updateDataModel asks for its updates to be written: one {:write, %{path: path, value: value}} effect per entry, the path resolved against the calling scope.

Effects reach the renderer from an action (see A2UICore.Resolution.NodeResolver.invoke/5); a renderer applies them in order. Failures are errors with category :expression.

Summary

Types

The MCP client: {module, state}, or a function from a tool name to one.

Functions

The function implementations of the MCP catalog of version.

Types

client()

(since 0.1.0)
@type client() ::
  A2UICore.MCP.Client.t() | (String.t() -> A2UICore.MCP.Client.t() | nil)

The MCP client: {module, state}, or a function from a tool name to one.

Functions

implementations(version, options \\ [])

(since 0.1.0)
@spec implementations(String.t(), keyword()) :: %{
  optional(String.t()) => A2UICore.Catalog.Function.execute()
}

The function implementations of the MCP catalog of version.

Options: :client — the client/0 callMcpTool uses. Without one, callMcpTool fails.