Skip to main content
Glama
cliwant

mcp-sam-gov

by cliwant

sam_fetch_attachment_text

Read-only

Extracts text from SAM.gov opportunity attachments such as RFPs and SOWs using their download URLs. Returns plain text with extraction metadata, handling PDF and HTML formats.

Instructions

Extract the TEXT of a SAM notice attachment (the actual RFP / SOW / Q&A / wage tables) by its download URL — so an AI can read the real solicitation, not just its metadata. Give it a sam_get_opportunity attachments[].url (resourceLinks). Keyless. Handles PDF (via pdfjs) + text/HTML; returns { format, text, pages, filename, sizeBytes, truncated, extracted }. HONEST: a DOCX / binary that can't be read keyless returns text:null + a note (never fabricated); a corrupt/encrypted PDF returns text:null + an extractionError note (never a crash); a DOWN fetch throws a retryable upstream_unavailable (never empty text); a 404 throws not_found. Only sam.gov / api.sam.gov URLs are fetched (SSRF hygiene). maxChars caps the text (default 200000) and truncation is disclosed.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesSAM attachment download URL from sam_get_opportunity → attachments[].url / resourceLinks (https://sam.gov/api/prod/opps/v3/opportunities/resources/files/{id}/download). Must be a sam.gov / api.sam.gov host.
maxCharsNoCap on returned text characters (default 200000, max 500000). Truncation is disclosed in _meta (truncated:true).
Behavior5/5

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

Extensively discloses behavior: handles PDF via pdfjs and text/HTML, returns structure with key fields, handles errors (corrupt/encrypted PDF, DOCX/binary, fetch failures, 404), SSRF hygiene, and truncation disclosure. This goes far beyond the readOnlyHint annotation.

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 dense paragraph, front-loaded with purpose, no fluff. Every sentence adds essential information about behavior or constraints.

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?

Despite no output schema, description fully explains returned fields (format, text, pages, etc.) and error-handling behavior. Addresses edge cases and constraints (SSRF, truncation). Complete for a tool of this complexity.

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 has 100% parameter description coverage. Description adds important context: url must come from sam_get_opportunity → resourceLinks, maxChars default and max, and that truncation is disclosed. Adds modest 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?

Clearly states it extracts text from a SAM notice attachment, specifies input type (download URL), and distinguishes from metadata-only tools like sam_get_opportunity. Verb 'Extract the TEXT' is specific and actionable.

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

Usage Guidelines4/5

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

Describes when to use: to read the real solicitation instead of metadata. Implies use after sam_get_opportunity. Does not explicitly mention when not to use or list alternatives, but context is clear enough.

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/cliwant/mcp-sam-gov'

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