Skip to main content
Glama

gia_ingest_document

Ingest text content into a governed retrieval system with integrity verification and audit trail. Documents are chunked, embedded, and hash-verified for trustworthy retrieval.

Instructions

Governed document ingestion — upload text content for governed retrieval. Content is chunked, embedded, hash-verified, and stored with full audit trail. Each chunk gets SHA-256 integrity hash. Classification: ADVISORY — creates governed content, audited.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleYesDocument title
contentYesFull text content to ingest
domainYesDomain classification (e.g., va-claims, finance, eu-ai-act)
trust_levelNoTrust level (SYSTEM > ORG > CASE > EPHEMERAL)CASE
classificationNoDocument classification. Controls which retrievals can surface it when a classification floor is in force (MANDATORY > ADVISORY > INFORMATIONAL). Defaults to ADVISORY.
allowed_rolesNoRoles allowed to retrieve this document
ttl_hoursNoTime-to-live in hours (auto-expires)

Implementation Reference

  • The async handler function for gia_ingest_document. It POSTs to /api/retrieval/ingest with the document's title, content, filename (slugified), domain, trustLevel, classification, allowedRoles, and ttlHours. Returns JSON on success or an error payload on failure.
      async (args) => {
        try {
          const result = await apiCall<unknown>('/api/retrieval/ingest', 'POST', {
            title: args.title,
            content: args.content,
            filename: `${args.title.toLowerCase().replace(/\s+/g, '-')}.txt`,
            domain: args.domain,
            trustLevel: args.trust_level,
            classification: args.classification,
            allowedRoles: args.allowed_roles,
            ttlHours: args.ttl_hours,
          });
    
          return {
            content: [{
              type: 'text' as const,
              text: JSON.stringify(result, null, 2),
            }],
          };
        } catch (err: unknown) {
          return {
            content: [{
              type: 'text' as const,
              text: JSON.stringify(
                errorPayload(err, 'gia_ingest_document', {
                  title: args.title,
                  domain: args.domain,
                  classification: args.classification,
                }),
                null,
                2,
              ),
            }],
            isError: true,
          };
        }
      }
    );
  • Zod schema for gia_ingest_document: title, content, domain, trust_level (enum SYSTEM/ORG/CASE/EPHEMERAL, default CASE), classification (optional enum MANDATORY/ADVISORY/INFORMATIONAL), allowed_roles (optional string array), ttl_hours (optional number).
    {
      title: z.string().describe('Document title'),
      content: z.string().describe('Full text content to ingest'),
      domain: z.string().describe('Domain classification (e.g., va-claims, finance, eu-ai-act)'),
      trust_level: z.enum(['SYSTEM', 'ORG', 'CASE', 'EPHEMERAL']).default('CASE').describe('Trust level (SYSTEM > ORG > CASE > EPHEMERAL)'),
      classification: z.enum(['MANDATORY', 'ADVISORY', 'INFORMATIONAL']).optional().describe('Document classification. Controls which retrievals can surface it when a classification floor is in force (MANDATORY > ADVISORY > INFORMATIONAL). Defaults to ADVISORY.'),
      allowed_roles: z.array(z.string()).optional().describe('Roles allowed to retrieve this document'),
      ttl_hours: z.number().optional().describe('Time-to-live in hours (auto-expires)'),
    },
  • Registration of gia_ingest_document via server.tool() with name, description, schema, and metadata hints (readOnlyHint: false, idempotentHint: false).
    server.tool(
      'gia_ingest_document',
      'Governed document ingestion — upload text content for governed retrieval. Content is chunked, embedded, hash-verified, and stored with full audit trail. Each chunk gets SHA-256 integrity hash. Classification: ADVISORY — creates governed content, audited.',
      {
        title: z.string().describe('Document title'),
        content: z.string().describe('Full text content to ingest'),
        domain: z.string().describe('Domain classification (e.g., va-claims, finance, eu-ai-act)'),
        trust_level: z.enum(['SYSTEM', 'ORG', 'CASE', 'EPHEMERAL']).default('CASE').describe('Trust level (SYSTEM > ORG > CASE > EPHEMERAL)'),
        classification: z.enum(['MANDATORY', 'ADVISORY', 'INFORMATIONAL']).optional().describe('Document classification. Controls which retrievals can surface it when a classification floor is in force (MANDATORY > ADVISORY > INFORMATIONAL). Defaults to ADVISORY.'),
        allowed_roles: z.array(z.string()).optional().describe('Roles allowed to retrieve this document'),
        ttl_hours: z.number().optional().describe('Time-to-live in hours (auto-expires)'),
      },
      {
        title: 'Governed Document Ingestion',
        readOnlyHint: false,
        idempotentHint: false,
        destructiveHint: false,
        openWorldHint: false,
      },
      async (args) => {
        try {
          const result = await apiCall<unknown>('/api/retrieval/ingest', 'POST', {
            title: args.title,
            content: args.content,
            filename: `${args.title.toLowerCase().replace(/\s+/g, '-')}.txt`,
            domain: args.domain,
            trustLevel: args.trust_level,
            classification: args.classification,
            allowedRoles: args.allowed_roles,
            ttlHours: args.ttl_hours,
          });
    
          return {
            content: [{
              type: 'text' as const,
              text: JSON.stringify(result, null, 2),
            }],
          };
        } catch (err: unknown) {
          return {
            content: [{
              type: 'text' as const,
              text: JSON.stringify(
                errorPayload(err, 'gia_ingest_document', {
                  title: args.title,
                  domain: args.domain,
                  classification: args.classification,
                }),
                null,
                2,
              ),
            }],
            isError: true,
          };
        }
      }
    );
  • Registration call in the MCP server setup: registerGovernedRetrievalTools(instrumentedServer) is called when the 'tenant' tier is allowed.
    // Governed retrieval (special: no engine param)
    if (allowedTiers.has(GOVERNED_RETRIEVAL_TIER)) {
      registerGovernedRetrievalTools(instrumentedServer);
      registeredCount++;
  • The errorPayload helper function used by the handler to structure error responses with code, message, httpStatus, details, and tool name.
    function errorPayload(
      err: unknown,
      tool: string,
      context: Record<string, unknown>,
    ): { error: true; code: string; message: string; httpStatus?: number; details?: Record<string, unknown>; tool: string } & Record<string, unknown> {
      if (err instanceof RetrievalApiError) {
        return {
          error: true,
          code: err.code,
          message: err.message,
          httpStatus: err.httpStatus,
          details: err.details,
          tool,
          ...context,
        };
      }
      return {
        error: true,
        code: 'INTERNAL_ERROR',
        message: errMsg(err),
        tool,
        ...context,
      };
    }
Behavior5/5

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

Description details process: chunking, embedding, SHA-256 hashing, full audit trail, and classification as ADVISORY. This adds extensive behavioral context beyond annotations, which only indicate non-readonly, non-destructive, non-idempotent, non-open-world.

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?

Three sentences front-loading purpose, then process details. No redundant information. Every sentence adds value.

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?

Description covers ingestion process and audit trail well. Missing info on return value (no output schema) and behavior if roles/expectations fail. Still fairly complete for a tool with good annotations.

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

Parameters3/5

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

Schema covers 100% of parameters with descriptions. Description does not add new parameter-level semantics beyond stating default classification. No additional detail on parameter usage or 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?

Description clearly states the tool's purpose: upload text content for governed retrieval with chunking, embedding, hash-verification, and audit trail. It uses specific verbs and distinguishes from siblings like gia_retrieve.

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

Usage Guidelines3/5

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

Description implies usage for governed document ingestion but does not explicitly state when to use or avoid this tool compared to alternatives. No guidance on scenarios or exclusions.

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/knowledgepa3/gia-mcp-server'

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