Skip to main content
Glama

Fetch test artifacts

wopee_fetch_artifact

Retrieve a test artifact from an analysis suite, such as user stories or Playwright test code. Returns the content as text for review or editing, without modifying any data.

Instructions

Retrieve a specific test artifact from a suite. Returns the artifact content as text. Use this to review what wopee_generate_artifact created, or to retrieve existing artifacts before editing with wopee_update_artifact. Does NOT modify any data — this is a read-only operation. If the requested artifact type has not been generated yet for this suite, returns an empty result. For PLAYWRIGHT_CODE, you must provide the test case identifier (e.g. 'US004:TC006'); omitting it returns an error. For all other types, the identifier parameter is ignored.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
typeYesType of test artifact to retrieve. One of: APP_CONTEXT (application description), GENERAL_USER_STORIES (stories without test cases), USER_STORIES (stories with test cases), PLAYWRIGHT_CODE (generated test code — requires identifier), PROJECT_CONTEXT (project-level context).
suiteUuidYesUUID of the analysis suite to fetch artifacts from. Get this from wopee_fetch_analysis_suites.
identifierNoTest case identifier in format 'US004:TC006'. Required only when type is PLAYWRIGHT_CODE. Ignored for all other artifact types.

Implementation Reference

  • The core handler function `fetchArtifact` that executes the tool logic: validates input via Zod schema, builds a GraphQL input, calls the API via `requestClient`, and returns the artifact content as text.
    export async function fetchArtifact(input: FetchArtifactHandlerInput): Promise<{
      content: {
        type: "text";
        text: string;
      }[];
    }> {
      try {
        const { type, suiteUuid, identifier } = input;
    
        const fetchArtifactInput = createFetchArtifactInput({
          type,
          suiteUuid,
          ...(identifier ? { identifier } : {}),
        });
        const parsedInput = FetchArtifactInputSchema.parse(fetchArtifactInput);
        const result = await requestClient<{
          fetchArtifact: {
            content: string | null;
            blobSha: string | null;
            commitSha: string | null;
            commitDate: string | null;
          };
        }>(FetchArtifact, {
          input: parsedInput,
        });
        if (!result?.fetchArtifact?.content)
          return {
            content: [
              {
                type: "text" as const,
                text: "Failed to fetch file: no content returned",
              },
            ],
          };
    
        return {
          content: [
            {
              type: "text" as const,
              text: result.fetchArtifact.content,
            },
          ],
        };
      } catch (error) {
        return _parseError(error);
      }
    }
  • The tool definition object `wopeeFetchArtifact` that wires the tool name, metadata/description, input schema, and delegates to the shared `fetchArtifact` handler.
    export const wopeeFetchArtifact = {
      name: ToolName.WOPEE_FETCH_ARTIFACT,
      config: {
        title: "Fetch test artifacts",
        description:
          "Retrieve a specific test artifact from a suite. Returns the artifact content as text. Use this to review what wopee_generate_artifact created, or to retrieve existing artifacts before editing with wopee_update_artifact. Does NOT modify any data — this is a read-only operation. If the requested artifact type has not been generated yet for this suite, returns an empty result. For PLAYWRIGHT_CODE, you must provide the test case identifier (e.g. 'US004:TC006'); omitting it returns an error. For all other types, the identifier parameter is ignored.",
        inputSchema: FetchArtifactHandlerInputSchema.shape,
      },
      handler: async (input: FetchArtifactHandlerInput) =>
        await fetchArtifact(input),
    };
  • `FetchArtifactHandlerInputSchema` — input schema for the tool handler: validates type (ArtifactType enum), suiteUuid, and optional identifier.
    export const FetchArtifactHandlerInputSchema = z.object({
      type: z.nativeEnum(ArtifactType, {
        description:
          "Type of test artifact to retrieve. One of: APP_CONTEXT (application description), GENERAL_USER_STORIES (stories without test cases), USER_STORIES (stories with test cases), PLAYWRIGHT_CODE (generated test code — requires identifier), PROJECT_CONTEXT (project-level context).",
      }),
      suiteUuid: z
        .string({
          description:
            "UUID of the analysis suite to fetch artifacts from. Get this from wopee_fetch_analysis_suites.",
        })
        .min(1, "Suite UUID is required"),
      identifier: z
        .string({
          description:
            "Test case identifier in format 'US004:TC006'. Required only when type is PLAYWRIGHT_CODE. Ignored for all other artifact types.",
        })
        .optional(),
    });
  • `FetchArtifactInputSchema` — internal input schema used after factory transformation, includes projectUuid, suiteUuid, type, optional identifier and ref.
    export const FetchArtifactInputSchema = z.object({
      projectUuid: z.string().min(1, "Project UUID is required"),
      suiteUuid: z.string().min(1, "Suite UUID is required"),
      type: z.nativeEnum(ArtifactType),
      identifier: z
        .string({
          description:
            "Identifier for the test case to fetch playwright code for, ex. `US004:TC006`, should be provided only for `PLAYWRIGHT_CODE` artifact type",
        })
        .nullish(),
      ref: z.string().nullish(), // branch, tag or commit sha
    });
  • Tool registration: `wopeeFetchArtifact` is imported and added to the `TOOLS` array at line 21, making it available as an MCP tool.
    import { wopeeFetchArtifact } from "./wopee_fetch_artifact/index.js";
    import { wopeeUpdateArtifact } from "./wopee_update_artifact/index.js";
    import { wopeeGenerateArtifact } from "./wopee_generate_artifact/index.js";
    import { wopeeDispatchAgent } from "./wopee_dispatch_agent/index.js";
    import { wopeeDispatchAnalysis } from "./wopee_dispatch_analysis/index.js";
    import { wopeeCreateBlankSuite } from "./wopee_create_blank_suite/index.js";
    import { wopeeFetchAnalysisSuites } from "./wopee_fetch_analysis_suites/index.js";
    import { wopeeFetchExecutedTestCases } from "./wopee_fetch_executed_test_cases/index.js";
    import { wopeeSendChatMessage } from "./wopee_send_chat_message/index.js";
    import { wopeeReadChatHistory } from "./wopee_read_chat_history/index.js";
    import { wopeeCreateGithubIssue } from "./wopee_create_github_issue/index.js";
    
    export const TOOLS = [
      wopeeCreateBlankSuite,
      wopeeFetchAnalysisSuites,
      wopeeFetchExecutedTestCases,
    
      wopeeDispatchAnalysis,
      wopeeDispatchAgent,
    
      wopeeFetchArtifact,
      wopeeUpdateArtifact,
      wopeeGenerateArtifact,
    
      wopeeSendChatMessage,
      wopeeReadChatHistory,
      wopeeCreateGithubIssue,
    ];
Behavior4/5

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

With no annotations, the description fully describes the read-only behavior, return format (text), empty result for missing artifacts, and identifier handling. No mention of rate limits or auth, but core behavioral traits are covered.

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

Conciseness5/5

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

Single paragraph, front-loaded with purpose, then concise usage notes. Every sentence adds value with no redundancy or fluff.

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

Completeness5/5

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

Given no annotations or output schema, the description covers all essential aspects: behavior, parameters, special cases, and differentiation from siblings. Complete for a fetch tool.

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 covers 100% of parameters with descriptions, but the description adds extra context: the special identifier requirement for PLAYWRIGHT_CODE and that identifier is ignored for other types. This adds value beyond schema.

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 uses a specific verb ('Retrieve') and resource ('test artifact from a suite'), clearly distinguishing it from sibling tools like wopee_generate_artifact and wopee_update_artifact.

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?

Explicitly states when to use (review created artifacts, retrieve before editing) and provides alternatives by naming sibling tools. Also clarifies read-only nature and special requirements for PLAYWRIGHT_CODE.

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/Wopee-io/wopee-mcp'

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