Skip to content

MCP Resources

Copy page

In addition to invokable tools, the MCP server can expose resources (static or generated data identified by a URI) and prompts (reusable prompt templates).

import { McpClient } from "@divinci-ai/mcp";
const client = new McpClient({
serverUrl: "https://mcp.divinci.app",
});
await client.connect();
const resources = await client.listResources();
for (const resource of resources) {
console.log(`${resource.uri}${resource.name}`);
}
const { contents } = await client.readResource("divinci://workspace/ws_abc123/runbook.md");
for (const part of contents) {
if (part.text) {
console.log(part.text);
}
}
FieldTypeDescription
uristringUnique resource URI
namestringHuman-readable name
descriptionstring?Optional description
mimeTypestring?Optional MIME type

Prompts are reusable templates the server publishes. List and fetch them with listPrompts() and getPrompt():

const prompts = await client.listPrompts();
const filled = await client.getPrompt("summarize_thread", {
thread_id: "thr_abc123",
style: "executive",
});
for (const message of filled.messages) {
console.log(message.role, message.content);
}

The server pushes a notifications/resources/list_changed event when its resource catalog changes. Subscribe via the onResourcesChanged event to refresh your local list automatically.

  • Tools — invoke server-exposed actions
  • Overview — connection, auth, and configuration