Skip to main content
Glama
Arize-ai

@arizeai/phoenix-mcp

Official
by Arize-ai

add-dataset-examples

Add synthetic examples to existing datasets for AI model evaluation and improvement, ensuring data diversity while maintaining structural consistency.

Instructions

Add examples to an existing dataset.

This tool adds one or more examples to an existing dataset. Each example includes an input, output, and metadata. The metadata will automatically include information indicating that these examples were synthetically generated via MCP. When calling this tool, check existing examples using the "get-dataset-examples" tool to ensure that you are not adding duplicate examples and following existing patterns for how data should be structured.

Example usage: Look at the analyze "my-dataset" and augment them with new examples to cover relevant edge cases

Expected return: Confirmation of successful addition of examples to the dataset. Example: { "dataset_name": "my-dataset", "message": "Successfully added examples to dataset" }

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
datasetNameYes
examplesYes

Implementation Reference

  • Handler function that processes the tool call: adds 'Synthetic Example added via MCP' metadata to examples, appends them to the dataset via PhoenixClient POST /v1/datasets/upload (action: append), and returns confirmation with dataset_id.
    async ({ datasetName, examples }) => {
      // Add MCP metadata to each example
      const examplesWithMetadata = examples.map((example) => ({
        ...example,
        metadata: {
          ...example.metadata,
          source: "Synthetic Example added via MCP",
        },
      }));
    
      const response = await client.POST("/v1/datasets/upload", {
        body: {
          action: "append",
          name: datasetName,
          inputs: examplesWithMetadata.map((e) => e.input),
          outputs: examplesWithMetadata.map((e) => e.output),
          metadata: examplesWithMetadata.map((e) => e.metadata),
        },
        params: {
          query: {
            sync: true,
          },
        },
      });
    
      if (!response.data?.data?.dataset_id) {
        throw new Error(
          "Failed to add examples to dataset: No dataset ID received"
        );
      }
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(
              {
                dataset_name: datasetName,
                dataset_id: response.data.data.dataset_id,
                message: "Successfully added examples to dataset",
              },
              null,
              2
            ),
          },
        ],
      };
    }
  • Input schema using Zod: requires datasetName (string) and examples (array of {input, output, optional metadata}, all records of any).
      datasetName: z.string(),
      examples: z.array(
        z.object({
          input: z.record(z.any()),
          output: z.record(z.any()),
          metadata: z.record(z.any()).optional(),
        })
      ),
    },
  • Registers the 'add-dataset-examples' tool on the MCP server with name, description constant, input schema, and handler function.
    server.tool(
      "add-dataset-examples",
      ADD_DATASET_EXAMPLES_DESCRIPTION,
      {
        datasetName: z.string(),
        examples: z.array(
          z.object({
            input: z.record(z.any()),
            output: z.record(z.any()),
            metadata: z.record(z.any()).optional(),
          })
        ),
      },
      async ({ datasetName, examples }) => {
        // Add MCP metadata to each example
        const examplesWithMetadata = examples.map((example) => ({
          ...example,
          metadata: {
            ...example.metadata,
            source: "Synthetic Example added via MCP",
          },
        }));
    
        const response = await client.POST("/v1/datasets/upload", {
          body: {
            action: "append",
            name: datasetName,
            inputs: examplesWithMetadata.map((e) => e.input),
            outputs: examplesWithMetadata.map((e) => e.output),
            metadata: examplesWithMetadata.map((e) => e.metadata),
          },
          params: {
            query: {
              sync: true,
            },
          },
        });
    
        if (!response.data?.data?.dataset_id) {
          throw new Error(
            "Failed to add examples to dataset: No dataset ID received"
          );
        }
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(
                {
                  dataset_name: datasetName,
                  dataset_id: response.data.data.dataset_id,
                  message: "Successfully added examples to dataset",
                },
                null,
                2
              ),
            },
          ],
        };
      }
    );
  • Top-level call to initializeDatasetTools which registers the dataset tools including 'add-dataset-examples' on the MCP server.
    initializeDatasetTools({ client, server });
  • Description string for the 'add-dataset-examples' tool, passed to server.tool().
    const ADD_DATASET_EXAMPLES_DESCRIPTION = `Add examples to an existing dataset.
    
    This tool adds one or more examples to an existing dataset. Each example includes an input,
    output, and metadata. The metadata will automatically include information indicating that
    these examples were synthetically generated via MCP. When calling this tool, check existing
    examples using the "get-dataset-examples" tool to ensure that you are not adding duplicate
    examples and following existing patterns for how data should be structured.
    
    Example usage:
      Look at the analyze "my-dataset" and augment them with new examples to cover relevant edge cases
    
    Expected return:
      Confirmation of successful addition of examples to the dataset.
      Example: {
        "dataset_name": "my-dataset",
        "message": "Successfully added examples to dataset"
      }`;
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full burden. It discloses that metadata 'will automatically include information indicating that these examples were synthetically generated via MCP' (a behavioral trait) and mentions the expected return format. However, it doesn't cover potential errors, permissions needed, or rate limits.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the core purpose, followed by usage guidance and return format. The example usage paragraph is slightly verbose but informative. Overall, most sentences earn their place, though it could be tighter.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a mutation tool with no annotations and 0% schema coverage, the description does well by explaining parameters, usage prerequisites, and return format. However, without an output schema, it could more fully document error cases or side effects.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It explains that 'examples' include 'input, output, and metadata' and that metadata gets auto-enhanced with synthetic generation info. This adds meaning beyond the bare schema, though it doesn't detail 'datasetName' or example structure constraints.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('adds one or more examples to an existing dataset') and distinguishes it from siblings like 'get-dataset-examples' (read vs. write) and 'list-datasets' (metadata vs. content). It specifies the resource (dataset) and what gets added (examples with input, output, metadata).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicit guidance is provided: 'check existing examples using the "get-dataset-examples" tool to ensure that you are not adding duplicate examples and following existing patterns.' This names a specific sibling tool as a prerequisite and gives clear when-to-use context (avoid duplicates, follow patterns).

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Arize-ai/phoenix'

If you have feedback or need assistance with the MCP directory API, please join our Discord server