Skip to main content
Glama

get_event_artifact

Retrieve sanitized event artifacts from orchestrated coding-agent runs using run_id, sequence number, and JSON Pointer field_path to access specific data points.

Instructions

Read a sanitized event artifact by run_id, seq, and JSON Pointer field_path.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
run_idYes
seqYes
field_pathYes
offsetNo
limitNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
seqYes
mimeYes
offsetYes
run_idYes
contentYes
relpathYes
encodingYes
has_moreYes
field_pathYes
total_bytesYes
returned_bytesYes

Implementation Reference

  • Registers the 'get_event_artifact' MCP tool with the server, defining its name, description, input/output schemas, and the async handler that calls manager.getEventArtifact()
    export function registerGetEventArtifactTool(server: McpServer, manager: RunManager): void {
      server.registerTool(
        'get_event_artifact',
        {
          description: 'Read a sanitized event artifact by run_id, seq, and JSON Pointer field_path.',
          inputSchema: getEventArtifactSchema,
          outputSchema: getEventArtifactResultSchema,
        },
        async (args) => {
          try {
            const result = await manager.getEventArtifact(args);
            return asToolResult(result);
          } catch (error) {
            return asToolError(String(error));
          }
        },
      );
    }
  • Main handler method in RunManager that processes get_event_artifact requests. Delegates to storage.readEventArtifact() for active runs or storage.readEventArtifactById() for persisted runs.
    async getEventArtifact(input: GetEventArtifactInput): Promise<GetEventArtifactResult> {
      const managed = this.findManagedRun(input.run_id);
      if (managed) {
        return this.storage.readEventArtifact(
          managed.record.cwd,
          managed.record.runId,
          input.seq,
          input.field_path,
          input.offset ?? 0,
          input.limit ?? 65536,
        );
      }
    
      return this.storage.readEventArtifactById(
        input.run_id,
        input.seq,
        input.field_path,
        input.offset ?? 0,
        input.limit ?? 65536,
      );
    }
  • Core storage implementation that reads artifact data from manifest files and chunked binary files, returning the artifact content with metadata (mime type, encoding, offset, has_more, etc.)
    async readEventArtifact(
      cwd: string,
      runId: string,
      seq: number,
      fieldPath: string,
      offset: number,
      limit: number,
    ): Promise<GetEventArtifactResult> {
      const manifest = await this.readArtifactManifest(cwd, runId, seq);
      const field = manifest.fields[fieldPath];
      if (!field) {
        throw new Error(
          `No artifact for field_path ${fieldPath}. Available field paths: ${Object.keys(manifest.fields).join(', ') || '(none)'}`,
        );
      }
    
      const eventDir = path.join(this.getArtifactsDir(cwd, runId), eventDirName(seq, manifest.event_type));
      const buffer = await readFieldBuffer(eventDir, field, offset, limit);
      return {
        run_id: runId,
        seq,
        field_path: fieldPath,
        mime: field.mime,
        encoding: field.encoding,
        relpath: field.relpath,
        total_bytes: field.total_bytes,
        offset,
        returned_bytes: buffer.length,
        has_more: offset + buffer.length < field.total_bytes,
        content: buffer.toString('utf8'),
      };
    }
    
    async readEventArtifactById(
      runId: string,
      seq: number,
      fieldPath: string,
      offset: number,
      limit: number,
    ): Promise<GetEventArtifactResult> {
      const cwd = await this.resolveRunCwd(runId);
      if (!cwd) {
        throw new Error(`Unknown run_id: ${runId}`);
      }
      return this.readEventArtifact(cwd, runId, seq, fieldPath, offset, limit);
    }
  • Input schema for get_event_artifact: validates run_id, seq, field_path, and optional offset/limit parameters
    export const getEventArtifactSchema = z.object({
      run_id: z.string().min(1),
      seq: z.number().int().min(1),
      field_path: z.string().min(1),
      offset: z.number().int().min(0).default(0),
      limit: z.number().int().min(1).max(262144).default(65536),
    });
  • Output schema for get_event_artifact result: defines run_id, seq, field_path, mime, encoding, relpath, total_bytes, offset, returned_bytes, has_more, and content fields
    export const getEventArtifactResultSchema = z.object({
      run_id: z.string(),
      seq: z.number().int().min(1),
      field_path: z.string(),
      mime: z.string(),
      encoding: z.string(),
      relpath: z.string(),
      total_bytes: z.number().int().min(0),
      offset: z.number().int().min(0),
      returned_bytes: z.number().int().min(0),
      has_more: z.boolean(),
      content: z.string(),
    });
Behavior2/5

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

With no annotations provided, the description carries full burden but only states it's a read operation. It doesn't disclose behavioral traits like authentication requirements, rate limits, error conditions, what 'sanitized' means, or how the JSON Pointer field_path works. The mention of 'sanitized' hints at data transformation but lacks details.

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?

Extremely concise single sentence with zero wasted words. Front-loaded with the core purpose, and every element (verb, resource, parameters) earns its place. No structural issues despite the brevity.

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

Completeness3/5

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

Given 5 parameters with 0% schema coverage and no annotations, the description is incomplete—it doesn't explain parameter semantics or behavioral context. However, the existence of an output schema reduces the need to describe return values. For a read operation, this is minimally adequate but leaves important gaps.

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

Parameters2/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 but only lists parameter names without explaining their meaning. It mentions 'run_id, seq, and JSON Pointer field_path' but doesn't clarify what these identifiers represent, what 'offset' and 'limit' do, or how field_path syntax works. This leaves significant gaps in parameter understanding.

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

Purpose4/5

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

The description clearly states the action ('Read') and resource ('sanitized event artifact') with specific identifiers (run_id, seq, field_path). It distinguishes from siblings like get_run or list_runs by focusing on artifacts rather than runs themselves. However, it doesn't explicitly contrast with poll_events which might also retrieve event data.

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

Usage Guidelines2/5

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

No guidance on when to use this tool versus alternatives like poll_events or get_run. The description mentions parameters but doesn't provide context about appropriate use cases, prerequisites, or when other tools might be more suitable. This leaves the agent without clear decision criteria.

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/dufangshi/orchestration-mcp'

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