Module: CompletionKit::McpTools::Imports

Extended by:
Base
Defined in:
app/services/completion_kit/mcp_tools/imports.rb

Constant Summary collapse

TOOLS =
{
  "promptfoo_import" => {
    description: "Import a promptfooconfig.yaml. Creates a prompt, a dataset from the test vars, and metrics from the assert blocks (llm-rubric/g-eval become judge metrics; contains/equals/regex/is-json become deterministic check metrics). Returns a summary of what mapped and what was skipped and why; nothing is dropped silently.",
    inputSchema: {
      type: "object",
      properties: {
        config: {type: "string", description: "The full promptfooconfig.yaml contents."}
      },
      required: ["config"]
    },
    handler: :promptfoo_import
  }
}.freeze

Class Method Summary collapse

Methods included from Base

call, definitions, error_result, text_result

Class Method Details

.promptfoo_import(args) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
# File 'app/services/completion_kit/mcp_tools/imports.rb', line 20

def self.promptfoo_import(args)
  result = PromptfooImporter.call(args["config"])
  return error_result(result.error) unless result.ok

  text_result(
    prompts: result.prompts,
    dataset: result.dataset,
    metrics: result.metrics,
    providers: result.providers
  )
end