Skip to main content
Glama
useshortcut

Shortcut MCP Server

Official
by useshortcut

documents-get-by-id

Retrieve a document in markdown format using its unique ID from the Shortcut project management system.

Instructions

Get a document as markdown by its ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
docIdYesThe ID of the document to retrieve

Implementation Reference

  • The handler function for the 'documents-get-by-id' tool. It retrieves the document by ID using the Shortcut client and returns a formatted result or error.
    private async getDocumentById(docId: string) {
    	try {
    		const doc = await this.client.getDocById(docId);
    		if (!doc) return this.toResult(`Document with ID ${docId} not found.`);
    		return this.toResult(`Document with ID ${docId}`, doc);
    	} catch (error) {
    		const errorMessage = error instanceof Error ? error.message : "Unknown error";
    		return this.toResult(`Failed to get document: ${errorMessage}`);
    	}
    }
  • Input schema validation using Zod for the document ID parameter.
    {
    	docId: z.string().describe("The ID of the document to retrieve"),
    },
  • Registration of the 'documents-get-by-id' tool on the MCP server, including description, input schema, and handler binding.
    server.addToolWithReadAccess(
    	"documents-get-by-id",
    	"Get a document as markdown by its ID",
    	{
    		docId: z.string().describe("The ID of the document to retrieve"),
    	},
    	async ({ docId }: { docId: string }) => await tools.getDocumentById(docId),
    );
  • Helper method used by the handler to format the tool response as MCP CallToolResult with JSON data embedded in text.
    protected toResult(
    	message: string,
    	data?: unknown,
    	paginationToken?: string | null | undefined,
    ): CallToolResult {
    	return {
    		content: [
    			{
    				type: "text",
    				text: `${message}${data !== undefined ? `\n\n<json>\n${JSON.stringify(data, null, 2)}\n</json>${paginationToken ? `\n\n<next-page-token>${paginationToken}</next-page-token>` : ""}` : ""}`,
    			},
    		],
    	};
    }
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 the basic operation. It doesn't disclose behavioral traits like whether it's read-only (implied but not stated), authentication needs, rate limits, error conditions, or what happens with invalid IDs. The description is minimal beyond the core action.

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 a single, efficient sentence that front-loads the core purpose with zero wasted words. Every word earns its place: 'Get' (action), 'a document' (resource), 'as markdown' (format), 'by its ID' (identifier).

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?

For a simple read operation with 1 parameter and 100% schema coverage, the description is minimally adequate. However, with no annotations and no output schema, it should ideally mention the return format (markdown) more explicitly and note it's a safe read operation. It's complete enough for basic use but lacks depth for robust agent understanding.

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 100%, so the schema already fully documents the single parameter (docId). The description adds no additional meaning beyond what's in the schema, such as format examples or ID sourcing. Baseline 3 is appropriate when schema does the heavy lifting.

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 ('Get') and resource ('a document as markdown'), specifying the format and identifier requirement. It distinguishes from siblings like documents-list (list all) and documents-search (search queries), but doesn't explicitly contrast with documents-create (creation vs retrieval).

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 when you have a specific document ID, but doesn't explicitly state when to use this versus alternatives like documents-search for unknown IDs or documents-list for browsing. 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/useshortcut/mcp-server-shortcut'

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