Skip to main content
Glama
ibm-ecm

IBM Core Content Services MCP Server

Official
by ibm-ecm

get_folder_documents

Retrieve documents from a specific folder in IBM FileNet Content Manager to access and manage stored files.

Instructions

Retrieves a folder's contained documents.

:param folder_id_or_path: The folder id or path.

:returns: A list contains documents in the folder

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
folder_id_or_pathYes

Implementation Reference

  • The handler function for the 'get_folder_documents' tool. It executes a GraphQL query to fetch documents contained in the specified folder (by ID or path), constructs Document objects from the response, and returns the list. Returns a ToolError on failure.
    @mcp.tool( name="get_folder_documents", ) async def get_folder_documents( folder_id_or_path: str, ) -> Union[list[Document], ToolError]: """ Retrieves a folder's contained documents. :param folder_id_or_path: The folder id or path. :returns: A list contains documents in the folder """ method_name = "get_folder_documents" logger.info("%s started", method_name) try: query = """ query getContainedDocuments($object_store_name: String!, $folder_id_or_path: String!){ folder( repositoryIdentifier: $object_store_name identifier: $folder_id_or_path ) { containedDocuments { documents { id name className properties { id value } } } } } """ variables = { "folder_id_or_path": folder_id_or_path, "object_store_name": graphql_client.object_store, } # return await graphql_client.execute_async(query=query, variables=variables) docs = await graphql_client.execute_async(query=query, variables=variables) if "errors" in docs: return ToolError( message=f"get_folder_documents failed: got err {docs}.", ) docslist = docs["data"]["folder"]["containedDocuments"]["documents"] if len(docslist) == 0: return [] else: contained_docs = [] for doc in docslist: onedoc = Document.create_an_instance( graphQL_changed_object_dict=doc, class_identifier=doc["className"], ) contained_docs.append(onedoc) return contained_docs except Exception as ex: error_traceback = traceback.format_exc(limit=TRACEBACK_LIMIT) logger.error( f"{method_name} failed: {ex.__class__.__name__} - {str(ex)}\n{error_traceback}" ) return ToolError( message=f"{method_name} failed: got err {ex}. Trace available in server logs.", )
  • Call to register_folder_tools within register_server_tools for CORE server type, which defines and registers the get_folder_documents tool among others.
    register_folder_tools(mcp, graphql_client)
  • Call to register_folder_tools within register_server_tools for FULL server type, which defines and registers the get_folder_documents tool among others.
    register_folder_tools(mcp, graphql_client)

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/ibm-ecm/ibm-content-services-mcp-server'

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