Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
d28dc58
Update docstrings and fix README
h3xxit Aug 26, 2025
018806c
Merge pull request #52 from universal-tool-calling-protocol/dev
h3xxit Aug 27, 2025
0f2af7e
Merge pull request #53 from universal-tool-calling-protocol/dev
h3xxit Aug 27, 2025
d28c0af
Update documentation and fix MCP plugin
h3xxit Sep 7, 2025
7ba8b3c
Merge pull request #61 "Update CLI" from universal-tool-calling-proto…
h3xxit Sep 7, 2025
908cd40
Merge pull request #63 from universal-tool-calling-protocol/dev
h3xxit Sep 8, 2025
74a11e2
Merge pull request #69 from universal-tool-calling-protocol/dev
h3xxit Sep 21, 2025
03a4b9f
Merge pull request #70 from universal-tool-calling-protocol/dev
h3xxit Oct 7, 2025
8443cda
Merge branch 'dev'
h3xxit Oct 7, 2025
0150a3b
Merge branch 'dev'
h3xxit Oct 7, 2025
6e2c671
socket protocol updated to be compatible with 1.0v utcp
Oct 25, 2025
9cea90f
cubic fixes done
Oct 26, 2025
7016987
pinned mcp-use to use langchain 0.3.27
Oct 26, 2025
718b668
removed mcp denpendency on langchain
Oct 27, 2025
ca252e5
adding the langchain dependency for testing (temporary)
Oct 27, 2025
45793cf
remove langchain-core pin to resolve dependency conflict
Oct 27, 2025
662d07d
feat: Updated Graphql implementation to be compatible with UTCP 1.0v
Nov 6, 2025
3aed349
Added gql 'how to use' guide in the README.md
Nov 6, 2025
dca4d26
updated cubic comments for GraphQl
Nov 12, 2025
4a2aea4
Update comment on delimeter handling
Thuraabtech Nov 17, 2025
21cbab7
Merge branch 'dev' into feature/graphql-1.0v
h3xxit Nov 29, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 47 additions & 1 deletion plugins/communication_protocols/gql/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,47 @@
Find the UTCP readme at https://github.com/universal-tool-calling-protocol/python-utcp.

# UTCP GraphQL Communication Protocol Plugin

This plugin integrates GraphQL as a UTCP 1.0 communication protocol and call template. It supports discovery via schema introspection, authenticated calls, and header handling.

## Getting Started

### Installation

```bash
pip install gql
```

### Registration

```python
import utcp_gql
utcp_gql.register()
```

## How To Use

- Ensure the plugin is imported and registered: `import utcp_gql; utcp_gql.register()`.
- Add a manual in your client config:
```json
{
"name": "my_graph",
"call_template_type": "graphql",
"url": "https://your.graphql/endpoint",
"operation_type": "query",
"headers": { "x-client": "utcp" },
"header_fields": ["x-session-id"]
}
```
- Call a tool:
```python
await client.call_tool("my_graph.someQuery", {"id": "123", "x-session-id": "abc"})
```

## Notes

- Tool names are prefixed by the manual name (e.g., `my_graph.someQuery`).
- Headers merge static `headers` plus whitelisted dynamic fields from `header_fields`.
- Supported auth: API key, Basic auth, OAuth2 (client-credentials).
- Security: only `https://` or `http://localhost`/`http://127.0.0.1` endpoints.

For UTCP core docs, see https://github.com/universal-tool-calling-protocol/python-utcp.
9 changes: 9 additions & 0 deletions plugins/communication_protocols/gql/src/utcp_gql/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from utcp.plugins.discovery import register_communication_protocol, register_call_template

from .gql_communication_protocol import GraphQLCommunicationProtocol
from .gql_call_template import GraphQLProvider, GraphQLProviderSerializer


def register():
register_communication_protocol("graphql", GraphQLCommunicationProtocol())
register_call_template("graphql", GraphQLProviderSerializer())
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
from utcp.data.call_template import CallTemplate
from utcp.data.auth import Auth
from utcp.data.auth import Auth, AuthSerializer
from utcp.interfaces.serializer import Serializer
from utcp.exceptions import UtcpSerializerValidationError
import traceback
from typing import Dict, List, Optional, Literal
from pydantic import Field
from pydantic import Field, field_serializer, field_validator

class GraphQLProvider(CallTemplate):
"""Provider configuration for GraphQL-based tools.
Expand All @@ -27,3 +30,31 @@ class GraphQLProvider(CallTemplate):
auth: Optional[Auth] = None
headers: Optional[Dict[str, str]] = None
header_fields: Optional[List[str]] = Field(default=None, description="List of input fields to be sent as request headers for the initial connection.")

@field_serializer("auth")
def serialize_auth(self, auth: Optional[Auth]):
if auth is None:
return None
return AuthSerializer().to_dict(auth)

@field_validator("auth", mode="before")
@classmethod
def validate_auth(cls, v: Optional[Auth | dict]):
if v is None:
return None
if isinstance(v, Auth):
return v
return AuthSerializer().validate_dict(v)


class GraphQLProviderSerializer(Serializer[GraphQLProvider]):
def to_dict(self, obj: GraphQLProvider) -> dict:
return obj.model_dump()

def validate_dict(self, data: dict) -> GraphQLProvider:
try:
return GraphQLProvider.model_validate(data)
except Exception as e:
raise UtcpSerializerValidationError(
f"Invalid GraphQLProvider: {e}\n{traceback.format_exc()}"
)
Loading