Skip to main content
Glama

Get a message

get_message

Retrieve a Basecamp project message by ID and render its content in markdown, HTML, text, or raw JSON format for viewing or processing.

Instructions

Fetch a single message by ID; render body as markdown/html/text, or return raw JSON.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYes
message_idYes
renderNo

Implementation Reference

  • The handler fetches the message content from Basecamp API using project_id and message_id, renders the HTML body to the specified format (markdown, html, text, or json), and returns the formatted output.
    async ({ project_id, message_id, render }) => {
      const msg = await bcRequest<any>(
        "GET",
        `/buckets/${project_id}/messages/${message_id}.json`
      );
      const subject = msg.subject ?? msg.title ?? "(no subject)";
      const html = msg.content || msg.body || "";
    
      const mode = render ?? "markdown";
      if (mode === "json") {
        return {
          content: [{ type: "text", text: JSON.stringify(msg, null, 2) }],
        };
      }
    
      const body = renderBody(html, mode as "markdown" | "html" | "text");
      const output =
        mode === "markdown"
          ? `# ${subject}\n\n${body}`
          : `${subject}\n\n${body}`;
    
      return { content: [{ type: "text", text: output }] };
    }
  • Input schema definition using Zod, including required project_id and message_id (numbers), and optional render format.
    {
      title: "Get a message",
      description:
        "Fetch a single message by ID; render body as markdown/html/text, or return raw JSON.",
      inputSchema: {
        project_id: z.number().int(),
        message_id: z.number().int(),
        render: z.enum(["markdown", "html", "text", "json"]).optional(), // default markdown
      },
    },
  • Direct registration of the 'get_message' tool on the MCP server, including name, schema, and handler.
    server.registerTool(
      "get_message",
      {
        title: "Get a message",
        description:
          "Fetch a single message by ID; render body as markdown/html/text, or return raw JSON.",
        inputSchema: {
          project_id: z.number().int(),
          message_id: z.number().int(),
          render: z.enum(["markdown", "html", "text", "json"]).optional(), // default markdown
        },
      },
      async ({ project_id, message_id, render }) => {
        const msg = await bcRequest<any>(
          "GET",
          `/buckets/${project_id}/messages/${message_id}.json`
        );
        const subject = msg.subject ?? msg.title ?? "(no subject)";
        const html = msg.content || msg.body || "";
    
        const mode = render ?? "markdown";
        if (mode === "json") {
          return {
            content: [{ type: "text", text: JSON.stringify(msg, null, 2) }],
          };
        }
    
        const body = renderBody(html, mode as "markdown" | "html" | "text");
        const output =
          mode === "markdown"
            ? `# ${subject}\n\n${body}`
            : `${subject}\n\n${body}`;
    
        return { content: [{ type: "text", text: output }] };
      }
    );
  • Helper function to render message HTML body into markdown (default), HTML, or plain text. Used by the get_message handler.
    function renderBody(
      html: string,
      render: "markdown" | "html" | "text" = "markdown"
    ): string {
      const markdown = td.turndown(html || "");
      if (render === "markdown") return markdown;
      if (render === "html") return html || "";
      // crude Markdown → plain-text
      return markdown
        .replace(/```[\s\S]*?```/g, "") // drop code blocks
        .replace(/`([^`]+)`/g, "$1") // inline code
        .replace(/!\[([^\]]*)]\([^)]*\)/g, "$1") // images
        .replace(/\[([^\]]+)]\([^)]*\)/g, "$1") // links
        .replace(/^[#>\-\*\d\.\s]+/gm, "") // headings/quotes/lists
        .replace(/[*_~`]/g, "") // emphasis
        .trim();
    }
  • Top-level call to registerMessageTools, which includes registration of the 'get_message' tool.
    registerMessageTools(server);
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions rendering options and raw JSON return, which adds some context beyond basic retrieval. However, it lacks critical details such as error handling (e.g., what happens if the ID doesn't exist), authentication requirements, rate limits, or whether this is a read-only operation. For a tool with no annotations, this leaves significant gaps in understanding its behavior.

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?

The description is highly concise and front-loaded, consisting of a single sentence that efficiently conveys the core functionality. Every word earns its place by specifying the action, resource, and key parameter behavior without unnecessary elaboration. It's appropriately sized for a straightforward retrieval tool.

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

Completeness2/5

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

Given the tool's moderate complexity (3 parameters, no annotations, no output schema), the description is incomplete. It covers basic purpose and rendering options but misses important contextual elements like error cases, authentication needs, or what the output looks like (beyond format options). Without annotations or output schema, the description should provide more behavioral and operational context to be fully helpful.

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 description coverage is 0%, so the schema provides no parameter descriptions. The description adds some semantic context by explaining the 'render' parameter's purpose (to specify output format as markdown/html/text/json) and implying 'message_id' identifies the message. However, it doesn't clarify 'project_id' or provide details on parameter interactions or constraints, leaving partial 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 tool's purpose with specific verbs ('fetch', 'render', 'return') and identifies the resource ('a single message by ID'). It distinguishes from sibling tools like 'list_messages' by specifying retrieval of a single message rather than listing multiple. However, it doesn't explicitly differentiate from other potential get operations like 'get_todoset' beyond the resource type.

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?

The description implies usage context by mentioning fetching by ID and rendering options, suggesting it's for retrieving specific messages. However, it doesn't provide explicit guidance on when to use this versus alternatives like 'list_messages' for multiple messages or other sibling tools for different resources. No exclusions or prerequisites are mentioned.

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/craigashields/basecamp-mcp'

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